1

I'm trying to play YouTube Live with ExoPlayer on Android device.

I know that ExoPlayer can play YouTube, according to:
1. Karim Abdell Salam's answer:
How to play youtube video in ExoPlayer in Android?
2. Teyam's answer:
Streaming a youtube live video to android app with exoplayer (DASH)

But, when I trying to post http://www.youtube.com/get_video_info?&video_id=[video_id] I'm not getting dashmpd property at the response. Also I tried https://www.youtube.com/get_video_info?&video_id=[video_id]&el=info&ps=default&eurl=&gl=US&hl=en accoording to Karim Abdell Salam comment, and here I'm getting status=fail&errorcode=2&reason=Invalid+parameters.

So how should I play YouTube with ExoPlayer if I can't post get_video_info successfully?

Note: I tried several YouTube videos, both Live and regular.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Almog
  • 98
  • 2
  • 9

1 Answers1

0

Seems like YouTube has recently made some changes there, so try https://www.youtube.com/get_video_info?&video_id=[video_id]&ps=default&eurl=&gl=US&hl=en i.e. without the el=info parameter which seems to not work anymore. This worked for me (especially for Live videos). This link will help you understand the significance of parameters like el. I am trying to solve a similar issue so if you find any other resources please do share.

  • So it's possible to play YouTube on ExoPlayer? Even without ads? – android developer Jul 22 '18 at 10:51
  • @SuryaPrakashKushawah i cheked your code it is not working. java.lang.NullPointerException: Attempt to invoke virtual method ‘java.lang.String at.huber.youtubeExtractor.YtFile.getUrl()’ – Vasudev Vyas Jul 08 '19 at 06:00