pod_player icon indicating copy to clipboard operation
pod_player copied to clipboard

Exception: videoQuality cannot be empty

Open AbdallahElhanafy opened this issue 1 year ago • 3 comments

this issue is happening with youtube videos such as this:

https://youtu.be/example and this is how I'm initializing the controller:

    try {
      controller = PodPlayerController(
        playVideoFrom: PlayVideoFrom.youtube('https://youtu.be/example'),
        podPlayerConfig: const PodPlayerConfig(
          autoPlay: true,
          isLooping: true,
          videoQualityPriority: [360], // Default quality priorities
        ),
      )..initialise();
    } catch (e) {
      // Log the error if initialization fails
      print('Error initializing PodPlayerController: $e');
    }
  }

AbdallahElhanafy avatar Jun 24 '24 11:06 AbdallahElhanafy

This appears to be an issue with the youtube_explode_dart dependency and youtube as a whole. If I understand it correctly, it looks like youtube may be nuking muxed video streams, which is why this stopped working. pod_player iterates over the muxed streams to build the list of urls, currently youtube is only returning muxed videos at 240p. Then pod_player removes 240p videos from the list leaving it empty.

https://github.com/Hexer10/youtube_explode_dart/issues/278

https://github.com/Tyrrrz/YoutubeExplode/issues/797

robisaks avatar Jun 26 '24 18:06 robisaks

This appears to be an issue with the youtube_explode_dart dependency and youtube as a whole. If I understand it correctly, it looks like youtube may be nuking muxed video streams, which is why this stopped working. pod_player iterates over the muxed streams to build the list of urls, currently youtube is only returning muxed videos at 240p. Then pod_player removes 240p videos from the list leaving it empty.

Hexer10/youtube_explode_dart#278

Tyrrrz/YoutubeExplode#797

Is there any possible workaround for this ? or even any usable alternative ?

AbdallahElhanafy avatar Jun 26 '24 19:06 AbdallahElhanafy

If you have access to the video, we found that re-uploading the video resulted in the muxed streams being present, but that is a very temporary solution.

The other alternative is to fork this repo, and then delete the bit of code that removes 240p from the list. At the very least then 240 will be available and something will play, instead of giving the end user an error.

Another option is to use an alternative to this library, like youtube_player_iframe, but it will have ads and related videos shown at the end. This is all part of youtubes crack down on ad blockers, so even if a workaround is found, it will break again.

robisaks avatar Jun 26 '24 20:06 robisaks