0

我在视频视图中通过 url *.m3u8 打开流视频
我的设备显示为 800x480
,但如果视频流分辨率为 1024x768,视频停止播放并且可能导致应用程序崩溃。

如何通过 url *.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
4

1 回答 1

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();
                            }
                        });
于 2014-01-29T13:11:46.113 回答