I am using vitamio to play streaming video in android. Although I can play rtsp with it, but I cannot play udp streaming.
I integrated vitamins through gradle
compile 'me.neavo:vitamio:4.2.2'
And using it for activity as below
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; } });
Here is my layout code
<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>
I tried the url for udp://@192.168.0.104:1234 (removing @) with no luck. rtsp streaming plays well.
It should be noted here that streaming is not really a streaming stream at some remote URL. I am broadcasting from my PC using vlc , and 192.168.0.104 is my local IP address of the computer. In the case of rtsp I can reproduce rtsp://192.168.0.104:8554/ss this url, but nothing rtsp://192.168.0.104:8554/ss for udp , there were no error messages in the log.
source share