Problems playing videos in Leanback example - android

I am trying to play my own videos in Android Leanback example (https://github.com/googlesamples/androidtv-Leanback) putting in PlaybackFragment.java line 178, in prepareMediaForPlaying(Uri.parse(...)) my own mp4 url and it doesn't work. I have an Source error and the log said that it couldn't access to this url. I know that the url that I am trying works properly, because I put it in a browser and it plays.
Could you help me please?

Try to understand which type of video are you going to play! HLS, DASH, MPEG or of which format!
after you got a basic understanding on them, look for exoplayer supporting video formats, then implement your desired one

Related

Android: Bitmovin I cant find the encoded video in the bitmovin console?

I have been searching all around the web to try to understand how to stream videos to my android app.
I learned:
That the videos must be in the HLS or MPEG-DASH format to be adaptive for streaming .
What I mean by adaptive streaming:
The kind of streaming that allows the user to change the quality while video is streaming.
What could help me do this:
The first thing should be to encode my videos into an HLS or MPEG-DASH, for that I found a service that could do this which is Bitmovin.
The second thing is to play the adaptive video, I found two ways exoplayer and Bitmovin-player.
The problem:
I made an account on bitmovin and tried to test an mp4 video to encode, but there are too many stuff there like input, output and manifest and I don't know what URL I should use to pass to the bitmovin player to play. I encoded the video but I don't know where the reference to the enocoded video is.
My question:
1) Is my approach of streaming videos correct?
2) Can someone explain which url I must pass to the player or where I can find the video that was encoded in Bitmovin cloud?
1) Is my approach of streaming videos correct?
Short answer: Yes :) Adaptive streaming is used by almost every major VoD platform out there, and a proper way to do that. Further it allows you and your viewers to either
let the player decide on its own to select the optimal quality for the given connection and device of the viewer to provide continuous playback
and the viewer can select a specific quality on their own as well, if they want to.
When creating adaptive streaming content using MPEG-DASH and/or HLS as streaming format, your output would typically consist of the following:
Video/Audio Segments
MPD Manifest, and/or HLS playlists
1) Your input file (e.g. an mp4 file) will be downloaded and splitted into segments, which are being processed by the Bitmovin encoding. Out of these, it creates the different qualities the player or your viewer can choose from later.
2) This segmented output is then transferred back to your own storage, e.g. a cloud storage like AWS Simple Storage, or Google Cloud Storage. Other output types like (S)FTP and many others can be used as well.
3) In order to play your created MPEG-DASH or HLS content, a MPD manifest and/or HLS playlist needs to be created. Those are basically an index for the player, which tells it which qualities are available and where to find them to start the playback.
2) Can someone explain which url I must pass to the player or where I can find the video that was encoded in Bitmovin cloud?
The URL you would have to provide to the player, has to point the MPD and/or HLS master playlist, that gets transferred to your storage. Bitmovin doesn't offer a hosting service for your encoded content, which is why you didn't find an URL to the manifest that is used. So you would need a storage first, where the encoding could be transferred to.
Give the getting started guide a try. Select your preferred API client. Then you will be guided step by step on how to integrate this encoding service. I hope this helps :)
To test the playback of the player you can also have a look at https://bitmovin.com/demos/stream-test and select "Use our defaults" which provide URL's to sample content for testing the player and playback.

Unable to stream YouTube Url in VLC android

I have already integrated VLC player in my android app in Linux environment.But now the issue is when i try to play the YouTube link .It Unable to stream the YouTube URL and the concerned g-data ".3gp" URL.The error is mentioned below.
"http://www.youtube.com/watch?v=oq1gNicFkeM can not be played." in Toast.
Does anyone have any idea on the same?
I have found a temporary solution.I'm not an expert, but this did the trick for me:
Find a website which can download youtube video's (I suggest keepvid.com)
Paste the url of your youtube video into the designated bar and, although we are not downloading anything, hit the Download button.
Now the website gives you a list with different formats for you to choose from. RIGHT-click the one on top (mp4?) and copy the link's adress.
This link can be played in VLC Android and includes your youtube video.
VLC for Android does not support the lua plugins needed to parse the YT URL.
You need to parse the HTML layout yourself (and feed the resulting URL to VLC) or add support for lua plugins to VLC for Android to solve this issue.

Youtube video in VideoView

I want to play a remote video in a Videoview. Anybody knows a good free server to load my videos in it to later stream in a videoview? Is possible to see in a videoview Youtube videos? I have see another questions but I donĀ“t understand. Anybody can put a example to play a Youtube video or remote video for another server in a videoview?
Thank you
You can check android-youtube-player, a project to make YouTube videos play in a VideoView. The usage instructions and sample Activity code is available.
You can definitely stream video directly into a VideoView without a problem, and you set it up normally as well:
Uri pathtoVideo = Uri.parse(path);
videoView.setVideoURI(pathToVideo);
However, there are a lot of videos on Youtube that aren't mobile-friendly, and will end up throwing a "This Video Cannot Be Played" error.
The MediaPlayer on Android can only play "progressive streamable contents" which basically means: 1. the movie atom has to precede all the media data atoms. 2. The clip has to be reasonably interleaved. If it doesn't, you'll get the error I mentioned above.
Have you considered the YouTube API for android? I recently posted a tutorial on how to use the video and thumbnail views from the API here

Streaming videos from websites?

I am trying to make an app that allows me to stream a video from a website and play that video in my app.
However, I would like to play this video from my app and not through youtube or anything else.
So you click a button and a video starts streaming and stays in my app and plays. Also, another quick question here, can I play videos from anywhere?
I think I read that it had to be .mp4 or something but im not sure. How can I tell if it's .mp4 by just looking at it?
If I really want to play a video that isnt .mp4 (or whatever it's supposed to be) is there any way at all that I could possibly play it?
The quickest way is to have a view dedicated to a Flash player which streams the video for you. You can generate the HTML at runtime and pass it into a WebView.
This is probably not what you are looking for because you mention that you want it to stream directly with Android. I thought I would put the suggestion out there though.
Edit:
You would use a WebView. Using the following function:
loadDataWithBaseURL(baseUrl, data, mimeType, encoding, historyUrl);
You pass in a base URL, which in this case can just be file:///android_asset/ and the data is your complete HTML code. etc.
The data would be set like so:
String data = "<html><head></head><body>flash player goes here</body></html>";
You would set the Flash player to occupy the whole screen, so that the size of the player is then determined by the size of your WebView.

How to play flv video in android?

I want to display my FLV video in emulator. Anybody who have already work on this?
Basically I need to play video from particular URL and assets folder. So just help on this topic.
You can play a FLV video using the flash plugin inside a WebView. See here.
Hope this will help you.
Edit:
These are done using Action Scripts.
Call the Action Script
Play flv using Action Script
flv programming
Also this
There is a workaround which will also allow you to play from a local asset resource, please read my answer to this similar question for a full solution:
Problem to load flv video in webview
I used flv.js in the webpage to make the html support flv video file without flash. Then use XWalkView something like webview in android studio to load the webpage. Use WWalkView..

Categories

Resources