2017-08-05 8 views
0

私はvitamioライブラリを使ってアンドロイドでビデオストリーミングを再生しています。私はrtspと一緒にストリーミングできますが、udpストリーミングは再生できません。vitamioはアンドロイドでudpストリーミングを再生できません

私はGradleの

compile 'me.neavo:vitamio:4.2.2' 

vitamio経由を統合し、ここで

 setContentView(R.layout.activity_main); 
     if (!io.vov.vitamio.LibsChecker.checkVitamioLibs(this)) //it will check the include library of Vitamio 
      return; 

     mVideoView = (VideoView) findViewById(R.id.videoView); 
     Vitamio.initialize(this); 
     mVideoView.setVideoPath("udp://@192.168.0.104:1234"); 
     //mVideoView.setVideoPath("rtsp://192.168.0.104:8554/ss"); 
     mVideoView.setVideoQuality(MediaPlayer.VIDEOQUALITY_HIGH); 
     mVideoView.setBufferSize(2048); 
     mVideoView.requestFocus(); 
     mVideoView.start(); 
     mVideoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { 
      @Override 
      public void onPrepared(MediaPlayer mediaPlayer) { 
       mediaPlayer.setPlaybackSpeed(1.0f); 
      } 


     }); 
     mVideoView.setOnErrorListener(new MediaPlayer.OnErrorListener() { 
      @Override 
      public boolean onError(MediaPlayer mp, int what, int extra) { 
       return false; 
      } 
     }); 

を次のように活動にそれを使用すると、レイアウト

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="me.example.vitamiotest.MainActivity"> 

    <io.vov.vitamio.widget.VideoView 
     android:layout_width="0dp" 
     android:layout_height="0dp" 
     android:id="@+id/videoView" 
     app:layout_constraintBottom_toBottomOf="parent" 
     app:layout_constraintLeft_toLeftOf="parent" 
     app:layout_constraintRight_toRightOf="parent" 
     app:layout_constraintTop_toTopOf="parent" /> 

</android.support.constraint.ConstraintLayout> 

ための私のコードで私は(udp://@192.168.0.104:1234にURLをchaning試してみました運がない@を取り除く)。 rtspストリーミングがうまくいきます。

これらのストリーミングは、実際には一部のリモートURLでストリーミングされていないことに注意してください。私はvlc192.168.0.104を使用して自分のPCからストリーミングしています。rtspの場合はrtsp://192.168.0.104:8554/ssを再生できますが、udpの場合は何も処理されず、エラーメッセージはログに記録されません。

答えて

0

お使いのPCでこのudpストリームを試してみるか、他のソフトウェアを使用してください。私のアプリで 、udpの蒸気が正しく再生されています。

mVideoView.setVideoPath("udp://@238.0.0.1:1234");

関連する問題