I implemented exoplayer to play hls and dash contents. But I am struggling to play the dash content with widevine protection. I looked into the example app for Exoplayer, but I did n't get proper idea to implement. Currently I have a dash url and server url. How to easily implement exoplayer to play this content?
The easiest way for you to test with your content and ensure the playback works is to modify the ExoPlayer sample.
Specifically, if you look at the file where the sample manifest and license servers URL's are defined, you can either add your own example or just replace the URL's in one of the samples with your own.
The sample data is in the file: media.exolist.json: https://github.com/google/ExoPlayer/blob/release-v2/demos/main/src/main/assets/media.exolist.json
Assuming your content is using Widevine DRM, you can add or modify one of the entries like this:
{
"name": "HD (cenc)",
"uri": "https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd",
"drm_scheme": "widevine",
"drm_license_uri": "https://proxy.uat.widevine.com/proxy?provider=widevine_test"
},
There are instructions here: https://github.com/google/ExoPlayer/blob/aeb306a164911aa1491b46c2db4da0d329c83c65/docs/demo-application.md#playing-your-own-content
Related
I am trying to play a video on my TV using chromecasting framework provided. The approach i followed for playing a mp4 works fine. But now i have different source to play. I have a video file pointed by m3u8 file placed on my server.
So, for playing m3u8 file on TV i am using the following MediaInfo object with variants for content-type mentioned here.
The MediaObject i am returning is:`
return new MediaInfo.Builder(Uri.parse(path).toString())
.setStreamType(MediaInfo.STREAM_TYPE_LIVE)
.setContentType("videos/mp4") //need to know **what should be content-type here**
.setMetadata(movieMetadata)
.setStreamDuration(mSelectedMedia.getData().getDuration() * 1000)
.build();
Please guide me for playing m3u8 file on my chromecast or TV.
Thanks
First of all, I don't see what issue you are running into; always include that in your post so that you can get a better response. Based on the description you have provided, it seems like you are casting a playlist pointing at some files; if that is the case, you shouldn't set the stream type to live stream, instead use the buffered type (like what you would do for a simple mp4). Secondly, what receiver are you using? Your receiver should be capable of handling m3u8 playlist. If you use a Styled or the Default receiver (or use the Reference receiver from our GitHub repo, then you should be fine. Finally, make sure you are using https for the vide streams (for playlists it is required) and also that your server supports CORS headers.
As suggested by #naddaf problem was with CORS. So, i simply added my domains (gstatic.com and one more in my case) on server from where i am getting requests for my media. And it all started working perfectly.
I want to know if there is a way I can generate a dash URL for use in ExoPlayer. Any help would be appreciated.
Usually Google provide the tool edash packger to make contents.
Can You try this one ?
https://github.com/google/edash-packager
If You used this tool You can make dash contents.
Thanks
Derrick.
Android SDK provides class MediaMetadataRetriever for extracting metadata from MP4 files. Is there a way to edit MP4 metadata fields using MediaCodec API (without ffmpeg)? My task is to reset rotation field.
mp4parser seems to be what you are looking for, although I'm not certain where exactly the rotation field is located in the MP4 (I don't know enough about the file layout). If you know which box (or "atom") the metadata is stored in, then the MetaDataRead and MetaDataInsert classes are pretty clear examples of how to read and write the data (they specifically work on the iTunes "Name"/"Title" field, but writing other metadata works the same way, once you know where it should be located). Hope this helps!
I have the mov file url which I have to play using videoview. But android does not support that as per http://developer.android.com/guide/appendix/media-formats.html
So is there any way to play mov ulr video using video view or remultiplex (or re-encode, depending on the source) into an something that Android plays nice with, e.g. an mp4 container?
You can use ffmpeg to convert the file on the device if necessary, but integrating ffmpeg is not trivial and converting a video on the device is compute intensive so will take time and use up your battery. If it is possible to change the format server side, it is generally much easier.
If you do want to use ffmpeg, a wrapper approach my be useful - this project provides an example: https://github.com/jhotovy/android-ffmpeg. I have used a similar approach and it works fine.
Make sure in particular you note the comments about calling ffmpeg twice.
There are players in Google play that will play mov files, but not everyone has had good experience with them (for example: https://stackoverflow.com/a/27006587/334402). VLC in particular is a common choice and projects exist to integrate it into Android apps (although maybe not via web views) e.g.: https://github.com/mrmaffen/vlc-android-sdk
I am working on an Android application which is supposed to play videos over HTTP on Android devices. Before we setup a server to host the video files just wanted a few things clarified:
As per the developer documentation, Android supports .mp4 and .3gp container formats for video. If we use H.263(video) - AAC LC (Audio) audio-video codec used for our media files will we be able to play the video by passing the URL to MediaPlayer class?
I did a little experiment and passed URL of one of the video files(.mp4) to the MediaPlayer class and got the following error:
Command PLAYER_INIT completed with an
error or info
PVMFErrContentInvalidForProgressivePlayback
From the docs, I came to know that for progressive playback, the video's index (e.g moov atom) should be at the start of the file.
Questions:
1. How do we make our videos Android-ready?
2. What are the different considerations that we need to make?
Please help.
Thanks.
You can actually achieve this using a pure Java implementation of ISO BMF ( MP4 ) container used JCodec ( http://jcodec.org ). For this use the following code:
MovieBox movie = MP4Util.createRefMovie(new File("bad.mp4"));
new Flattern().flattern(movie, new File("good.mp4"));
The side effect of 'Flattern' is creating a web optimized movie file that has it's header BEFORE the data.
You can also use similar functionality from command line:
java -cp jcodec-0.1.3-uberjar.jar org.jcodec.movtool.WebOptimize <movie>
The JCodec library can be downloaded from a project website.
I cross posted this question on Android-developers google group. Mark answered it there. Thanks Mark!
See this thread