2012-04-02 132 views
1

我試圖與視頻視圖中播放RTSP流: -Android的媒體播放器無法播放RTSP流拋出錯誤(100,0)

@Override 
    protected void onCreate(Bundle savedInstanceState) { 
     HEADER_BLOCK = true; 
     this.requestWindowFeature(Window.FEATURE_NO_TITLE); 
     setContentView(R.layout.video_view); 
     super.onCreate(savedInstanceState); 

     progressDialog = ProgressDialog.show(this, "Loading", "Opening video...", true); 
     mediaController = new MediaController(VideoStreamingActivity.this); 
     videoView = (VideoView) findViewById(R.id.myvideoview); 
     videoView.setMediaController(mediaController); 
     videoView.setVideoURI(Uri.parse(streamerUrl)); 
     videoView.setOnPreparedListener(new OnPreparedListener() { 
      @Override 
      public void onPrepared(MediaPlayer mp) { 
       progressDialog.dismiss(); 
       videoView.start(); 
       startTime = startTime * 60000; 
       videoView.seekTo(Integer.parseInt(String.valueOf(startTime).substring(0, String.valueOf(startTime).indexOf(".")))); 
       mediaController.show(); 
      } 
     }); 

     videoView.setOnErrorListener(new OnErrorListener() { 
      @Override 
      public boolean onError(MediaPlayer mp, int what, int extra) { 
       progressDialog.dismiss(); 
       if(what==1 && extra==-1){ 
        Toast.makeText(VideoStreamingActivity.this, 
          "Sorry!! unable to play the video since the video not compatible with your android player.", 
          Toast.LENGTH_LONG).show(); 
       } else { 
        Toast.makeText(VideoStreamingActivity.this, 
          "Unable to play selected video", Toast.LENGTH_LONG).show(); 
       } 
       VideoStreamingActivity.super.onBackPressed(); 
       return true; 
      } 
     }); 
    } 

的「streamerUrl」是wowza服務器生成正確的RTSP URL ......但在logcat中我收到以下錯誤。

04-02 09:22:41.476: D/VideoView(9178): onMeasure() 
04-02 09:22:41.476: I/VideoView(9178):  Setting size: 320x221 
04-02 09:22:41.484: D/VideoView(9178): onMeasure() 
04-02 09:22:41.484: I/VideoView(9178):  Setting size: 320x221 
04-02 09:22:41.546: V/GoogleAnalyticsTracker(9178): HTTP Response Code: 200 
04-02 09:22:41.578: I/MediaPlayer(9178): path is null 
04-02 09:22:41.578: D/MediaPlayer(9178): Couldn't open file on client side, trying server side 
04-02 09:22:41.679: D/VideoView(9178): onMeasure() 
04-02 09:22:41.679: I/VideoView(9178):  Setting size: 320x221 
04-02 09:22:41.679: D/VideoView(9178): onMeasure() 
04-02 09:22:41.679: I/VideoView(9178):  Setting size: 320x221 
04-02 09:22:50.210: W/AudioSystem(9178): AudioFlinger server died! 
04-02 09:22:50.210: W/IMediaDeathNotifier(9178): media server died 
04-02 09:22:50.210: E/MediaPlayer(9178): error (100, 0) 
04-02 09:22:50.210: E/MediaPlayer(9178): Error (100,0) 
04-02 09:22:50.210: D/VideoView(9178): Error: 100,0 

任何人都可以告訴發生了什麼?

+0

你找到一個解決錯誤100? – 2014-08-13 22:36:13

回答

0

記得添加互聯網訪問權限在manifest.xml文件:

rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov 

,如果它仍然不能正常工作,請告訴我:

<uses-permission android:name="android.permission.INTERNET" /> 

你可以通過嘗試測試RTSP視頻流知道what't問題