Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

YouTube video play with exoplayer library in Application

I have used the exoplayer library to play video in my application. But I can not play youtube video link using exoplayer.

I am getting below exception:

ExoPlayerImplInternal: Source error. com.google.android.exoplayer2.source.UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor) could read the stream.

I have searched on that but I have got the suggestion to use youtube android player API. But if we don't want to use youtube API. If anyone knows other option to play youtube video using exolayer only then please answer here.

like image 826
Kinal Mer Avatar asked Dec 03 '25 13:12

Kinal Mer


1 Answers

It's not possible to obtain direct links to YouTube videos for playback by ExoPlayer.

  • YouTube's Android Player API is the officially supported way of playing YouTube videos in Android applications.

  • Unfortunate to hear the need to use different player to stream youtube videos. This is irony since youtube app is internally using ExoPlayer.

  • Hope Google/Youtube avoids such duplicated efforts. A YoutubeMediaSource will save the developers having to familiarize yet another media player API.
like image 58
Prethivirajan Avatar answered Dec 06 '25 06:12

Prethivirajan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!