3

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();
Mycoola
  • 1,135
  • 1
  • 8
  • 29
Faisal Asif
  • 199
  • 2
  • 15

2 Answers2

5

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.

SweetWisher ツ
  • 7,296
  • 2
  • 30
  • 74
  • i just tried Vitamio Library as u suggested. but when i am trying to play a video, its playing very slow. i am trying this link [link](https://archive.org/download/ksnn_compilation_master_the_internet/ksnn_compilation_master_the_internet_512kb.mp4) and its working smooth and fine in my PC's web browser. – Faisal Asif Dec 10 '14 at 14:23
  • 1
    the problem is that i was testing this on emulator, its working perfect on real device. i am gonna mark this one as answer. thanks for your help. – Faisal Asif Dec 11 '14 at 14:08
1

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

chris
  • 313
  • 2
  • 12