如何在Android上玩m3u8?

前端之家收集整理的这篇文章主要介绍了如何在Android上玩m3u8?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
据我所知,Android 3.0及以上版本能够播放无线电流媒体m3u8 – http://developer.android.com/guide/appendix/media-formats.html

我将此链接http://content.mobile-tv.sky.com/content/ssna/live/ssnraudio.m3u8放入MediaPlayer,但在LogCat中,我得到:

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.

这是我的源代码

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();
            } 
        }
    });
}

解决方法

关注此链接
http://code.google.com/p/android/issues/detail?id=14646

– >

http://code.google.com/p/android/issues/detail?id=16884

– >

http://code.google.com/p/android/issues/detail?id=17118

(ARGGGGH!)

最后得出答案:

基本上在Android v2.3& v3.0,使用非标准的httplive://方案,在3.1中使用http://但是在一些代码解决了如何调用媒体框架中的相关方法.

原文链接:https://www.f2er.com/android/317083.html

猜你在找的Android相关文章