How to stream video from Http or RTSP Url in android

I want to play video from Http and Rtsp on Android. I am currently trying to use a http link. But when my activity starts, it just starts playing sound with a blank black screen. The video is not displayed. I posted my code below here. Thanks for any help in advance. and if someone can provide a fresh rtsp link for live streaming i would be very grateful.

    VideoView vidView = (VideoView)findViewById(R.id.myVideo);

    Uri stream = Uri.parse("http://www.androidbegin.com/tutorial/AndroidCommercial.3gp");

    vidView.setVideoURI(stream);

    MediaController vidControl = new MediaController(this);
    vidControl.setAnchorView(vidView);
    vidView.setMediaController(vidControl);
    vidView.requestFocus();
    vidView.start();

      

+3
android rtsp live-streaming android-videoview http-live-streaming


source to share


2 answers


You can easily do this through the Vitamio Libary . Vitamio supports 720p / 1080p HD, mp4, mkv, m4v, mov, flv, avi, rmvb, rm, ts, tp and many other video formats in Android and iOS. Almost all popular streaming protocols are supported by Vitamio, including HLS (m3u8), MMS, RTSP, RTMP, and HTTP.



You can download the demo version here .

+5


source to share


If VideoView doesn't work with your stream then you need to do it with ffmpeg



+1


source to share







All Articles
Loading...
X
Show
Funny
Dev
Pics