Faisal Asif
Faisal Asif

Reputation: 209

How to Stream Video from Http or RTSP Url in android

I want to play a video from Http and Rtsp on android. currently i am trying with http link But when my activity starts, it just starts playing audio with blank black screen. No video is displaying. Here i have posted my code below. Thanks for any help in advance. and if anyone can provide a fresh running rtsp link for live streaming, i'll be very thankful.

    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();

Upvotes: 3

Views: 3068

Answers (2)

chris
chris

Reputation: 313

If the VideoView does not work with your stream then you need to do it with ffmpeg

Upvotes: 1

SweetWisher ツ
SweetWisher ツ

Reputation: 7306

You can easily do it via 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 demo from here.

Upvotes: 5

Related Questions