Search code examples
androidyoutube-apileanback

how to play a youtube streaming video in android TV with leanback


I have yet to find a way to play an youtube streaming video in Android Tv using leanback library. Any suggestions or pointers are greatly appreciated.

I noticed that it will play mp4 files but not live streams.

here is code that works:

movie1.setVideoUrl("http://commondatastorage.googleapis.com/android-tv/Sample%20videos/Demo%20Slam/Google%20Demo%20Slam_%2020ft%20Search.mp4");
mItems.add(movie1);

That works just fine.

But if I change it to a streaming video like the following:

movie1.setVideoUrl("http//livestreaming2.itworkscdn.net/squranlive/squran_360p");
mItems.add(movie1);

it will not show the video on the screen. it is blank and then crashes.

And when I use this code:

movie1.setVideoUrl("http://www.youtube.com/embed/VopbGPJVkzM");
mItems.add(movie1);

it just crashes

Also - i have to connect it to my android 5.0.1 tablet and android studio does not show the logcat output in Android Studio. What do I need to turn on as an option in Android Studio for the logcat output to be seen (from the device run of the application)?

Thanks everyone.

ironmantis7x


Solution

  • I found that if i make a YT intent and then call that intent as an activity, it works.