2013-01-09 96 views
1

使用RTSP我用下面的代碼運行在videoview的rtsp鏈接視頻流在android系統

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

拋出異常我與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(); 
       } 
      } 
     });