Playing m3u8 form local storage - android

We want to play m3u8 with ts files stored locally on SD card in Android 4.0 and above devices.
I tried using video TAG inside HTML residing locally on the SD card and android native media player.
Both the codes are failing with the error. The same set of ts and m3u8 files are working fine when played from online when served from a webserver connected through http.
Can we play m3u8 using native support for files stored offline or do we need to use 3rd party libraries. I searched in internet and didn’t find article about not supporting the same.
Any help or recommendation would help my work.
Thanks a lot

Issue Solved
we used nano http server to serve m3u8 file to with all videos parts. Very simple and easy way to play m3u8 video file.

Related

m3u8 HLS Streaming not working in Android OS versions 6.0(M) and 5.0(L)

I am using MediaPlayer for Live steaming the Video using HLS medium.
The streaming file has extension .m3u8. The multimedia file is not able to provide streaming in Android OS versions MarshMallow and Lollipop in my case. Above OS version M the same file provides flawless streaming.
Questions that I am looking for the answers are below
Is it Hardware related issue?
Is it only OS related issue?
Why some of the m3u8 urls working fine on MediaPlayer implementation and some of not?
I am here sharing both the files the First one is working and the second one is not working.
1. Here is the First URL that working fine : https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8
One can find the internal details of the file here
++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#EXTM3U
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio/stereo/en/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="stereo",LANGUAGE="dubbing",NAME="Dubbing",DEFAULT=NO,AUTOSELECT=YES,URI="audio/stereo/none/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="surround",LANGUAGE="en",NAME="English",DEFAULT=YES,AUTOSELECT=YES,URI="audio/surround/en/320kbit.m3u8"
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="surround",LANGUAGE="dubbing",NAME="Dubbing",DEFAULT=NO,AUTOSELECT=YES,URI="audio/stereo/none/128kbit.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Deutsch",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="de",URI="subtitles_de.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="en",URI="subtitles_en.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Espanol",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="es",URI="subtitles_es.m3u8"
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="Français",DEFAULT=NO,AUTOSELECT=YES,FORCED=NO,LANGUAGE="fr",URI="subtitles_fr.m3u8"
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=258157,CODECS="avc1.4d400d,mp4a.40.2",AUDIO="stereo",RESOLUTION=422x180,SUBTITLES="subs"
video/250kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=520929,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="stereo",RESOLUTION=638x272,SUBTITLES="subs"
video/500kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=831270,CODECS="avc1.4d4015,mp4a.40.2",AUDIO="stereo",RESOLUTION=638x272,SUBTITLES="subs"
video/800kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1144430,CODECS="avc1.4d401f,mp4a.40.2",AUDIO="surround",RESOLUTION=958x408,SUBTITLES="subs"
video/1100kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1558322,CODECS="avc1.4d401f,mp4a.40.2",AUDIO="surround",RESOLUTION=1277x554,SUBTITLES="subs"
video/1500kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=4149264,CODECS="avc1.4d4028,mp4a.40.2",AUDIO="surround",RESOLUTION=1921x818,SUBTITLES="subs"
video/4000kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=6214307,CODECS="avc1.4d4028,mp4a.40.2",AUDIO="surround",RESOLUTION=1921x818,SUBTITLES="subs"
video/6000kbit.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=10285391,CODECS="avc1.4d4033,mp4a.40.2",AUDIO="surround",RESOLUTION=4096x1744,SUBTITLES="subs"
video/10000kbit.m3u8
++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++
2. The content of the NOT WORKING m3u8 file is here as I could not share the URL itself.
++++++++++++++++++++++++++++++++++++++++++++++++++
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-STREAM-INF:BANDWIDTH=1790800,AVERAGE-BANDWIDTH=1790800,CODECS="avc1.4d401f,mp4a.40.2",RESOLUTION=1024x576,FRAME-RATE=29.970,SUBTITLES="subs",CLOSED-CAPTIONS=NONE
XXXXXXX/1/XXXXXXX.m3u8
#EXT-X-MEDIA:TYPE=SUBTITLES,GROUP-ID="subs",NAME="English",DEFAULT=YES,AUTOSELECT=YES,FORCED=NO,LANGUAGE="eng",URI="XXXXXXX/XXXXXXX/XXXXXXX.m3u8"
++++++++++++++++++++++++++++++++++++++++++++++++++
Any help, suggestions, feedbacks will be appreciated.

Android Exoplayer caching m3u8 audio for offline support

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.

Android code : How to use YOUTUBE OFFLINE functionality for .mp3 files?

I am developing an android application for Online Music streaming. I want to download MP3 files from the server and play that file when the user is offline. And the downloaded file can only be played through applicaion
please give your best solution

Play Local m3u8 files in Android using NanoHttpd

I need to play local m3u8 file which is stored on device SD card. From my Google search I came to know that I should use nanoHttpd server but not able to find and samples or examples.
Please suggest me any sample codes or examples.

Stream wmv Videos from a url in my android app

i am creating an app for my website which contains lots of wmv video files.
and i want to be able to play them in my app.
i understand that android does not support wmv files so my question is:
is there any way for me to do this without to change all videos format in my site?
any modificatios to my videos via code (java - eclipse) or libraries, any loop holes?
I've been trying to create a site that has streaming video and I could never get Android devices to work with it. Then I found this...
http://www.longtailvideo.com/blog/31646/the-pain-of-live-streaming-on-android

Categories

Resources