视频流在Android中使用RTSP

时间:2013-01-09 05:41:56

标签: android rtsp

我使用以下代码在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

1 个答案:

答案 0 :(得分:1)

我使用VideoView在4.1上运行良好 我使用了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();
                }
            }
        });