6

My goal is to play a Youtube video in an application.

  • Youtube Player API is not what I want since there could be overlays in front of the video.
  • Webviews are terrible for performances and doesn't allow autoplay.

Exoplayer seems good but most of their doc is broken (links), incredibly complex for a very simple task, and doesn't provide working demos (their demo crashes...). Also, they don't explain how to properly get the DASH of a youtube URL.

So, is there a way to make Exoplayer work easily and get DASH info of any youtube link like https://www.youtube.com/watch?v=yFAnn2j4iB0 ?

I use http://www.youtube.com/get_video_info?&video_id=yFAnn2j4iB0 and once decoded I get this DASH url : https://manifest.googlevideo.com/api/manifest/dash/ms/au/nh/IgpwcjAxLnBhcjAxKgkxMjcuMC4wLjE/mv/m/source/youtube/requiressl/yes/ip/165.225.76.70/fexp/3300108,3300130,3300161,3313267,9419451,9422596,9424135,9425619,9426788,9428398,9431012,9431719,9433096,9433223,9433946,9435526,9438327,9438662,9439580,9441225,9441737,9442156,9442424,9442426,9442680,9443322,9443345,9443768,9443913,9444207,9445344/ipbits/0/as/fmp4_audio_clear,webm_audio_clear,webm2_audio_clear,fmp4_sd_hd_clear,webm2_sd_hd_clear/sparams/as,hfr,id,initcwndbps,ip,ipbits,itag,mm,mn,ms,mv,nh,pl,playback_host,requiressl,source,expire/pl/23/id/c850279f68f8881d/mn/sn-25g7snee/mm/31/hfr/1/playback_host/r18---sn-25g7snee.googlevideo.com/itag/0/mt/1471872416/sver/3/key/yt6/initcwndbps/9365000/expire/1471894709/upn/w1CO218TeQA/s/11395DF1FE7737DA54826F38EE1C61D28B46619DC.9724AB654EE916E8B5C5F687BE3504E4799BA939933

But it doesn't start buffing in the Exoplayer Demo. Is this DASH correct ? Does anyone of you use ExoPlayer in their app ?

Doc I found so far :
How to play youtube video in ExoPlayer in Android? https://github.com/google/ExoPlayer/tree/release-v1/demo_ext (but it crashes ><)

Community
  • 1
  • 1
Nino DELCEY
  • 652
  • 1
  • 9
  • 25

2 Answers2

0

If your goal is to play YouTube videos then use YouTube Android Player API. You need to provide direct URL to Exoplayer.

Parinda Rajapaksha
  • 2,963
  • 1
  • 36
  • 40
0

I successfully run the demo app. you can follow the guide at https://google.github.io/ExoPlayer/demo-application.html and clone the project on github https://github.com/google/ExoPlayer.git

a little note though, it is the most complex project I've ever seen, and need the longest time I ever experienced to build its gradle.

after gradle build complete, you just need to run the demo project.

Dika
  • 2,213
  • 4
  • 33
  • 49