1

我已使用以下代码在 videoview 中运行 rtsp 链接

    videoView.setMediaController(null);
    str = "rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov";
    uri = Uri.parse(str);
    videoView.setVideoURI(uri);
    videoView.requestFocus();
    videoView.start();

它在 Android2.3.3 中运行良好,但在 Android 4.0 中抛出异常

java.io.IOException: setDataSource failed.: status=0x80000000
4

1 回答 1

1

我使用了在 4.1 上运行良好的 VideoView,我使用了 MediaController。这是我的代码:

webView.setVideoURI(Uri.parse(videoUrl));

        // media control 
        webView.requestFocus();  
        MediaController mediaController = new MediaController(this);
        mediaController.setAnchorView(webView); 
        webView.setMediaController(mediaController);  

        webView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
            public void onPrepared(MediaPlayer mp) {
                // TODO Auto-generated method stub
                Log.d("VideoActivity","onPrepareListener");
                try {
                    progressDialog.dismiss();
                    webView.start();
                }
                catch (Exception e) {
                    // TODO: handle exception
                    e.printStackTrace();
                }
            }
        });
于 2013-01-09T06:21:44.790 回答