Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] VideoUnavailableException even though the video is available on youtube #271

Open
MxD-js opened this issue Feb 5, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@MxD-js
Copy link

MxD-js commented Feb 5, 2024

Describe the bug
YoutubeExplode library throws a VideoUnavailableException but when I go to youtube.com the video is available and has multiple streams. 1080, 720, 360 and so on. This usually happens when a stream was live and then the live stream ended and video is available on youtube after the live stream. If I wait long enough, or the following day the issue resolves it self, but this can be reproduced everytime a stream transitions from live to not live.

image

To Reproduce
Try to stream a live video then end the stream and attempt to play back the video after it's posted to youtube channel.

Future<Uri> _getYTMetadata(
    String videoId, YoutubeExplode ytXplode, bool isLive) async {
  if (isLive) {
    final liveStreamUrl =
        await ytXplode.videos.streams.getHttpLiveStreamUrl(VideoId(videoId));
    return Uri.parse(liveStreamUrl);
  } else {
    try {
      var manifest = await ytXplode.videos.streamsClient.getManifest(videoId);
      var muxedInfo = manifest.muxed.bestQuality;
      var videoUri = muxedInfo.url;
      return videoUri;
    } catch (e, stack) {
      print(e);
      print(stack);

      throw e;
    }
    // var streamInfo = manifest.video.withHighestBitrate();
  }
}

Youtube screenshot showing the video is available
image

Stacktrace

I/flutter ( 5847): VideoUnavailableException: Video "n39W2uq4aXw" does not contain any playable streams.
I/flutter ( 5847): #0      StreamClient.getManifest.<anonymous closure> (package:youtube_explode_dart/src/videos/streams/stream_client.dart:178:9)
I/flutter ( 5847): <asynchronous suspension>
I/flutter ( 5847): #1      retry (package:youtube_explode_dart/src/retry.dart:16:14)
I/flutter ( 5847): <asynchronous suspension>
I/flutter ( 5847): #2      _getYTMetadata (package:scc_mobile_app_v2/src/features/video_player/presentation/video_player_item_controller.dart:66:22)
I/flutter ( 5847): <asynchronous suspension>
I/flutter ( 5847): #3      videoPlayerItemController (package:scc_mobile_app_v2/src/features/video_player/presentation/video_player_item_controller.dart:23:15)
I/flutter ( 5847): <asynchronous suspension>
I/flutter ( 5847): #4      FutureHandlerProviderElementMixin.handleFuture.<anonymous closure>.<anonymous closure> (package:riverpod/src/async_notifier/base.dart:348:9)
I/flutter ( 5847): <asynchronous suspension>

Enviroment: (please complete the following information):

  • Enviroment: [Flutter o Dart VM]
  • Version 3.16.9
  • YoutubeExplode Version :2.1.0
    Additional context
    Add any other context about the problem here.

Flutter doctor output:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.9, on macOS 14.3 23D56 darwin-arm64, locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 15.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2022.3.2)
[✓] VS Code (version 1.86.0)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!
@MxD-js MxD-js added the bug Something isn't working label Feb 5, 2024
@MxD-js MxD-js changed the title [BUG] VideoUnavailableException when video is available on youtube [BUG] VideoUnavailableException even though the video is available on youtube Feb 5, 2024
@Hexer10
Copy link
Owner

Hexer10 commented Feb 26, 2024

Hi, sorry for the late reply, do you still get this error? I've just tried with the video id you provided any I could get all the streams correctly.

@MxD-js
Copy link
Author

MxD-js commented Feb 28, 2024

No worries we're all busy, I appreciate you getting this library out there, super helpful.

So, I don't get the error on the video I posted anymore.

The error can be reproduced when a youtube live stream end and the live stream video is available on youtube as a video. The error usually fixes it self in a day or so, like youtube needs to process the video? not sure.. but I do still get the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants