I have created an Android application which is capable of playing movies, which are protected with DRM (Widevine Modular). Video are in MPEG-DASH standard. In case, that device is online, everything works fine.
Now I need to add feature for playing video in offline mode. The problem is that I do not know how can I download some file(s) for offline playback. Everything what I have is .mpd file, which contains structured data.
How can I get some file(s) for download from this manifest .mpd file? There are no direct links to some video. I see some chunk, which looks like this:
media="chunk_ctvideo_cfm4s_rid$RepresentationID$_cs$Time$_w1003607280_qaWQ9QVBsSUxIMUpaRnVfdfdfkstMDImYXdsgdreaW9pbmRleD0w_mpd.m4s
I do not know if it is useful for me, but there is nothing more "noticeable" in the manifest file.
For an example of code that processes a manifest and downloads the media chunks have a look here: https://github.com/axiomatic-systems/Bento4/blob/master/Source/Python/utils/mp4-dash-clone.py
Of particular interest you may find the ProcessUrlTemplate which shows how to pass the media elements to get a URL for a chunk
Related
I am creating a music application.
I have used Exoplayer V2.8.0, So far I have achieved to play, pause next, prev, shuffle, repeat all songs using controls in-app and also with notification.
But all of this works only in online mode.
Now I want to add offline support to this app and allow a user to download the song offline and play while they are offline.
Audio files we are getting are *.m3u8 files.
But my problem is user should not access those downloaded files outside of my app. I have tried using one approach but it gives the mp3 files downloaded and combined from the different segments of the m3u8 file.
Can anyone guide me or give me sample or tutorial on how can I download the segments only and at the time of playing I can use that segment and play audio offline?
There is one suggestion for you,
If you want to create an offline player with .m3u8 or any other file then after download saves your file into your package folder with some of the different formats. Then while using that convert that specific formatted to mp3 or other which will help out for offline music play.
You can use a local http proxy server (NanoHttpd). Start the server and point your ExoPlayer to 127.0.0.1 so you can monitor the requests. Cache the m3u8 playlist plus the downloaded files for the first time you see a request. Next time when your proxy detects the same request, just play the files from cache.
I am using VideoJS to play videos served up from a fileserver. The files are in mp4 format, and work fine (using Flash fallback) on any desktop browser. However they do not work at all on mobile devices. For reference, feel free to check out:
http://74.203.203.93/content/aacfc5e7-fbeb-4785-ad04-023856a54a3d
I've tried to work the code around every which way I can think of to get it to work, but apparently I'm missing something somewhere. Does anyone have any ideas/suggestions?
More information:
Constants:
Video is in mp4 format (H.264 according to MediaInfo showing video codec being AVC).
Multiple formats are not possible (there will be no more than 1 (one) "source" tag).
Video file is hosted in a file server without a filename. Browser gets the location, and gets a source type tag.
Server is IIS.
Server supports byte-range requests.
Attempts so far:
Per http://help.videojs.com/discussions/problems/539-playing-mp4-on-android-using-videojs
Removed "type='video/mp4'" from tag.
Checked MIME types on server, video/mp4 is showing.
Per https://github.com/zencoder/video-js/blob/master/docs/api.md
Added javascript to call play() on ready.
Extension of above: tried javascript to call play() on click.
Tried adding '.mp4' to the end of the guid in the src location.
Swapped position of "type" and "src" elements of "source" tag.
I have changed the https:// in the source to http:// per several locations saying mobile doesn't do https well.
I changed the relative url in the src to an absolute url.
I will update with more information as I continue...
In the great media wars flash has been eliminated from androids, thats why the webm file is a key component in videojs.The mp4 file must be converted into a webm file and both sources used. You can just upload the webm vid to fileserver as well and link both sources in the player. The filenames in the link to the server must end in .mp4 and .webm to be recognized.
2 must reads -
http://www.zdnet.com/androids-flash-player-is-dead-live-with-it-7000002668/
http://www.pcadvisor.co.uk/how-to/google-android/3417930/how-get-flash-in-android-jelly-bean/
The quickest way to convert a mp4 to webm without software is to upload it to youtube, once the video is there copy the link and go to keepvid.com, then download the webm. Remember the highest quality webm file is not always optimal do to the size of mobile devices and slow internet connections planetwide. The video quality toggle on videojs is on the way though.
I've been following this blog to help me make a simple music player function with an Android app (http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html).
All works well - but I would like some way to extract a list of all music media stored on the phone so the user can click a file and play it. Does anyone know if this is possible via phone gap? I'd need to access track name/artist etc and a link to the track.
Cheers
Paul
Prognosis is not good.... PhoneGap does not have an API for accessing the media library. So, you would have to fall back to the File API to locate music files, and then... you would have to read the binary data in the actual files to extract out the track/artist metadata. Ouch. Seems pretty impractical.
[EDIT]
By the way, PhoneGap is not the only game in town. Appcelerator seems to solve the same problem, and apparently has a richer API, which includes
access to media metadata
I am looking to develop an application where I have to stream .m3u file, this is for ANDROID 3.0 only.
I want to stream this link
dl.dropbox.com/u/2377944/test/abr_test/index.m3u8
it must work in emulator too
I searched a lot, but nothing seems to be working too good.
Please help.
Thanks in advance.
m3u is a play list format, a text file, and not actually audio/video media itself. That means it references media that you would want to stream. The distinction is important.
The contents of the m3u file is important. (Your link is dead, btw.) Show that to use and we can help more. Each of the media files contained in the m3u must be valid and point to media that is compatible with Android.
What makes the media compatable? Check the Android Supported Media Formats page.
I'd like my Android application to download an mp3 file from the internet and play it like a stream while downloading it. Is this even possible? How would I go about doing it?
Essentially I want the user to be able to listen to the file instantly, but have it keep downloading to the SD Card even if he stops listening, so the whole mp3 file will end up on the SD Card either way.
I don't believe android provides the functionality you're asking for. But there's one workaround I know of that might work.
http://code.google.com/p/android/issues/detail?id=739 is an open ticket with a lot of discussion that relates to what you're describing. In the 5th comment seeingwithsound says
However, as a workaround I next stream my synthesized data to temporary files much like you consider streaming your HTTP streams to files, for subsequent playback of these files via MediaPlayer. [...] It looks though like your problem might be served by more control over MediaPlayer's buffering, because you are essentially concatenating streams through some cache mechanism (buffer) ...
To be honest I haven't played with MediaPlayer too much, so I can't give you too many details on how to "control MediaPlayer's buffering". But assuming you can get that to work, I suggest that you download your .mp3 file to (a) temporary file(s) which you can then point MediaPlayer to.
Sorry this answer is so vague, but you're entering territory that few others have before attempted. Good luck.
For Android devices 2.3 and earlier, you need to remove the Content-Disposition response header altogether. This will cause the browser to invoke the audio player of the user's preference.
Try it here: http://declinefm.com/archives select an archive of your choice, and tap the download link.
For modern Android devices, you can dispense with the removal of the CD header.
I have a tutorial here that I wrote inspired on your post:
http://rudd-o.com/linux-and-free-software/how-to-properly-stream-audio-from-your-plone-varnish-site
Enjoy!
RTSP or HTTP? If HTTP you can try and remove the Content-Length header which on some mobile devices will allow for immediate invocation of the player. It sounds as though you're pumping the data through a local app. How are you playing the file now?