Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to play m3u8 on Android?

As i understood, Android 3.0 and above are able for play radio streaming m3u8 - http://developer.android.com/guide/appendix/media-formats.html

I put this link - http://content.mobile-tv.sky.com/content/ssna/live/ssnraudio.m3u8 into MediaPlayer but in LogCat i get:

06-01 09:04:44.287: INFO/LiveSession(33): onConnect 'http://content.mobile-tv.sky.com/content/ssna/live/ssnraudio.m3u8'
06-01 09:04:44.287: INFO/NuHTTPDataSource(33): connect to content.mobile-tv.sky.com:80/content/ssna/live/ssnraudio.m3u8 @0
06-01 09:04:44.747: INFO/NuHTTPDataSource(33): connect to content.mobile-tv.sky.com:80/content/ssna/live/ssnraudio.m3u8 @0
06-01 09:04:45.019: INFO/NuHTTPDataSource(33): connect to content.mobile-tv.sky.com:80/content/ssna/live/ssnraudio/ssnr_052311_071632_78731.aac @0
**06-01 09:04:45.817: ERROR/LiveSession(33): This doesn't look like a transport stream...**
06-01 09:04:45.967: INFO/HTTPLiveSource(33): input data EOS reached.

This is my source code:

    mp = new MediaPlayer();        
    start.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub              
            try {

                mp.setDataSource("http://content.mobile-tv.sky.com/content/ssna/live/ssnraudio.m3u8");
                mp.prepare();
                mp.start();

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
        }
    });

    stop.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            try {

                mp.stop(); 
                mp.reset();

            } catch (Exception e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } 
        }
    });
}
like image 759
Saasha Avatar asked Jun 01 '11 09:06

Saasha


People also ask

How do I play m3u8 files on Android?

1 Answer. Show activity on this post. open m3u8 file in Notepad++ copy the m3u8 link and paste in m3u8 player to run m3u8 stream. Or you can directly open m3u8 player by clicking on m3u8 link.

How can I play m3u8 on my phone?

Even currently android builtin media player is able to play live urls inside an m3u8. Basically m3u8 is nothing else but text file to android. So you have to make m3u parser. If you are just looking for application, you can try and iptv which is free to use.

How do I play m3u8 video files?

M3U8 files can be opened using applications like VideoLAN VLC media player.


1 Answers

Try ExoMedia, streaming is as easy as:

emVideoView.setVideoURI(Uri.parse("https://archive.org/download/Popeye_forPresident/Popeye_forPresident_512kb.mp4"));

I works well with m3u8.

like image 199
Hendra Anggrian Avatar answered Nov 11 '22 17:11

Hendra Anggrian