在Android 4.0.3上流式传输m3u8播放列表 [英] Streaming m3u8 playlist on Android 4.0.3

查看:188
本文介绍了在Android 4.0.3上流式传输m3u8播放列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了以下播放列表:

I have created a following playlist:

#EXTM3U
#EXTINF:3,File - 1
http://pilatus.d1.comp.nus.edu.sg/~a0095695/video_repo/1.mp4
#EXTINF:3,File - 2
http://pilatus.d1.comp.nus.edu.sg/~a0095695/video_repo/2.mp4
#EXTINF:-1,File - 3
http://pilatus.d1.comp.nus.edu.sg/~a0095695/video_repo/3.mp4
#EXT-X-ENDLIST

我也在使用此代码在我的Android设备上播放:

Also I am using this code to play on my Android device:

MediaController mc = new MediaController(this);
VideoView videoview = (VideoView)findViewById(R.id.myvideoview);        
mc.setMediaPlayer(videoview);
videoview.setMediaController(mc);
videoview.setVideoURI(Uri.parse("http://pilatus.d1.comp.nus.edu.sg/~a0095695/video_repo/playlist.m3u8"));
videoview.requestFocus();
videoview.start();

我想要Dash流,所以会创建另一组m3u8文件,以适应带宽

I want Dash streaming, so would create another set of m3u8 files on top of it adapting to the bandwidth

问题是我收到的错误如无法播放文件

The problem is that I am getting error like "Cannot play the file"

我做错了什么?...

What am I doing wrong?...

谢谢

推荐答案

这是一个HLS流媒体,Android 4.0没有这种格式的问题。 toyr代码错误,尝试使用:

that is a HLS streaming, and Android 4.0 don't have problems with this format. toyr code are wrong, try to use :

VideoView videoview = (VideoView)findViewById(R.id.myvideoview);        
videoview.setMediaController(new MediaController(this));
videoview.setVideoURI(Uri.parse("http://pilatus.d1.comp.nus.edu.sg/~a0095695/video_repo/playlist.m3u8"));
videoview.requestFocus();
videoview.setOnPreparedListener(new OnPreparedListener() {
        public void onPrepared(MediaPlayer mp) {
            mp.start();
        }
    });

这篇关于在Android 4.0.3上流式传输m3u8播放列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆