据我所知,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=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://但是在一些代码中解决了如何调用媒体框架中的相关方法.