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

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

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

Related

Android Things video playback on Raspberry Pi

Has anyone been able to successfully play a video using Android Things on a Raspberry Pi? If so was there anything special you had to do to get it to work? If not does any one know why it isn't working?
I made a simple video player that plays a local video from disk. The app runs fine on a phone but I get an error dialog on the Pi saying "Can't play this video".
One Thing I have already ran into but I think I solved was there are no content providers in Android Things, so instead of using a uri for the video source I gave it a file directly like so.
EDIT: Code edit
VideoView videoPanel;
.
.
.
videoPanel.SetVideoURI(Android.Net.Uri.FromFile(new Java.IO.File("/sdcard/Movies/videoFile.mp4")));
I was using 0.5.1-devpreview with raspberry pi 3, and tried to use exoplayer to play mp4. Audio works but not video (just black screen). Same result for youtube iframe sdk (black screen with only audio playing).
I was able to get it to work for my project using setVideoPath instead of SetVideoURI. So your code would be
File file = new Java.IO.File("/sdcard/Movies/videoFile.mp4");
videoPanel.setVideoPath(file.getAbsolutePath());
Try adding this
android:hardwareAccelerated="true"
to your activity in the manifest.

Android: Create app to stream flash videos

I am trying to create an Android App to stream live/archived videos from my church's website.
However, I ran into a problem because all of the streams are giving .flv (flash) videos and or flash players...
I have succesfully been able to load .3gp videos in a VideoView but because Android doesn't support flash natively I tried to open the videos via the WebView.
This didn't work. At least, not for the links that I am working with. However, I can open youtube.com and click on any video to play it - but I can't play any of the streams from the church website.
My question:
Is there any way for me to make this work?
I have access to
1) rtsp stream of .f4v
2) http stream of .m3u8
3) rtmp stream of .fv4
I have spent 2 days searching the web for ideas or fixes and everything I find doesn't seem
to work with my particular case.
It seems to me that the only option is to have the church stream direct .3gp/mp4 files that I can access.
Otherwise, I have no clue how to make .f4v files work. No luck with the WebViews yet..
Do any of you have any suggestions for me?
P.S. I will also have to create an iOS app so looking for a solution that will work on
both platforms.
Thanks for your time!
To answer my own question:
It seems that the android emulator cannot play flash/m3u8 files.
However, my nexus 7 does just fine with both VideoView and WebView!
Cool library I found is Vitamio that is supposed to solve the problem I had.
I didn't use it however.

Video Player Options for Android

Android has a built in VideoPlayer which would seem to be the goto option, but just wondering if there might be even better open source video players for Android? This is for playing video within a commercial non-rooted android tablet.
http://code.google.com/p/dolphin-player/

Reliability of videoView in Android

I got a problem when using videoView to play progressive streaming mp4 videos. Sometimes, when I scrub through the video, the view does not change accordingly and just hang there. It's strange because the time on the videoView is still running which mean the player is running.
I test this on an Android 2.2 device. Is this problem caused by videoView ?
Thank you.
Since android emulator plays .mp4 and .3gpp format videos and the android's video view is not that much good to play a video without pixcelet or hanging it. But if you try to run the same application on an android phone the video will play fine without picxeleting and without being hang. I too faced the same problem earlier with emulator but when I ran the code on android phone it worked great.

Playing video file in Android

I want to play the video file and it's like
http://test.XXXX.com/myfile.wmv
am using Video view for that but it saying unable to play video error
I tried using WebView also but it showing only blank page.
Just i want to play that video link file in device online.
How to do that ?
Note : The links are working i tested on Windows browser.
Thanks
You will have to transcode the video to an android supported format and make the result available on your server as well.
http://developer.android.com/guide/appendix/media-formats.html provides an official overview of supported forms, but you may have more practical look googling for instructions on transcoding for android devices.

Categories

Resources