I download video with:
mPlayer.setDataSource("https://s3-eu-west-1.amazonaws.com/ellovidsout/1232/9/1423065486.mp4.m3u8")
Header contains following data:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=532000,RESOLUTION=400x224,CODECS="avc1.42001e,mp4a.40.2"
400k_1423065486.mp4.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1273000,RESOLUTION=640x360,CODECS="avc1.4d001f,mp4a.40.2"
1000k_1423065486.mp4.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=2476000,RESOLUTION=1024x576,CODECS="avc1.4d001f,mp4a.40.2"
2000k_1423065486.mp4.m3u8
Can I manually force media player to play only video with resolution 400x224 for example? (Except manually alerating url adding quality code to id)
You can use the method selectTrack and getTrackInfo Therefore, it doesn't work properly for all devices and Android OS version.
It might be helpfull to use ExoPlayer . Here you can check the demo app.
Related
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
Which library is useful to load audio or video file from API and play to the application? I tried glide for the image. But no idea about audio or video. (I want to fetch the image and file name to the recycle view after click operation file will play to the next activity.) A short guideline with library name is very helpful.
Android has MediaPlayer to load and play Audio and Video from URL. you can setDataSource as URL.
refer this answer...
You have Two approach one of them is using official Library (Media Player Library for music and VideoView for video) and other approach is using custom library I suggest you to using ExoPlayer Library for playing music and video
you can use following link:
https://github.com/google/ExoPlayer
I am able to play the videos in exoplayer using the source code at https://github.com/google/ExoPlayer, but unable to find, how to save video and play later while offline.
Also how segmented videos running through mpd files will be saved offline?
Any code snippet that I can put inside the exoplayer source code to make it work would be highly appreciable.
You can use a CacheDataSource and wrap your data source with it (eg. wrap the DefaultHttpDataSource).
I have video uploaded on server. which is trailer of movie. I can play this video direct to my videoView with the help of live url. My question: is there any method in android which help me out to get a video frame from url without download the video to local storage. I know one method name "createvideothumbnail" but it will not work in my case. because i need to get the video thumbnail without download the whole video. as you have seen the mechanism is implemented in imdb official app (Trailer section).
Please help, thanks in advance
Getting thumbnails without download the complete video is not possible until now (API Level 22) i´m pretty sure that the application that you describe load thumbnails that were created previously.
the current option would be using the class:
import android.provider.MediaStore.Video.Thumbnails;
or create the thumbnails in a separated process.
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.