Android Question [Solved] How I can play one video from youtube in ExoPlayer?

asales

Expert
Licensed User
Longtime User
I tried to do it this way, but it did not work:
B4X:
player1.Prepare(player1.CreateUriSource("https://www.youtube.com/watch?v=Mw1DYLvIV6U"))

This is the code:
B4X:
    If FirstTime Then
        player1.Initialize("player")
        player1.Prepare(player1.CreateUriSource("https://www.youtube.com/watch?v=Mw1DYLvIV6U"))
    End If

    Activity.LoadLayout("1")
    SimpleExoPlayerView1.Player = player1
    player1.Play

This is the error I get:
B4X:
Error: com.google.android.exoplayer2.source.ExtractorMediaSource$UnrecognizedInputFormatException: None of the available extractors (MatroskaExtractor, FragmentedMp4Extractor, Mp4Extractor, Mp3Extractor, AdtsExtractor, Ac3Extractor, TsExtractor, FlvExtractor, OggExtractor, PsExtractor, WavExtractor) could read the stream.

Thanks in advance for any tip.
 
Top