我在视频视图中通过网址* .m3u8打开视频流
我的设备显示为800x480
但如果视频流分辨率为1024x768,则视频停止播放并且可能会崩溃。
如何通过网址* .m3u8获取视频流的解析?或者如何调整视频流的大小?
mVideoView.setMediaController(new MediaController(OpenStream.this));
mVideoView.setVideoURI(Uri.parse(url));
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
mp.start();
}
});
错误:
01-29 18:21:12.831: E/MediaPlayer(23281): error (1, -2147483648)
01-29 18:21:12.831: V/MediaPlayer(23281): callback application
01-29 18:21:12.831: V/MediaPlayer(23281): back from callback
01-29 18:21:12.831: E/MediaPlayer(23281): Error (1,-2147483648)
01-29 18:21:12.831: D/VideoView(23281): Error: 1,-2147483648
答案 0 :(得分:1)
试试这个
mVideoView.setMediaController(new MediaController(OpenStream.this));
mVideoView.setVideoURI(Uri.parse(url));
mVideoView.requestFocus();
mVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
int w = mp.getVideoWidth();
int h = mp.getVideoHeight();
SurfaceHolder holder = mVideoView.getHolder();
holder.setFixedSize(w, h); // Or setup a proportional sizes
mp.start();
}
});