androidrtsprtsp-client

How to make RTSP Client on Android without any third party library?


Just looked on stackoverflow question post link RTSP Client Implementation on Android

Found another Android RTSP Client

Tried to implement with videoview and surfaceview.

--http web link video is coming. 
--http using VLC player no video
--rtsp using VLC player no video.

I am using code from Android RTSP Client

package com.weeklybuild.rtspviewer;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;

import android.net.Uri;
import android.widget.MediaController;
import android.widget.VideoView;

public class MainActivity extends Activity {

@Override
  public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);

  String uri = "rtsp://localhost:8554/test";  //giving Url as per VLC 
  VideoView v = (VideoView) findViewById( R.id.videoView );
  v.setVideoURI( Uri.parse(uri) );
  v.setMediaController( new MediaController( this ) );
  v.requestFocus();
  v.start();
 }
}

Can Someone tell me why unable to view video using RTSP ?


Solution

  • I'm guessing the reason is that the URI specified is not correct. Since the link,

    rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov

    works, we can be sure that the code works fine. I'm guessing the problem is because there is no codec to the URI provided in the question.

    The second link you provided, Android RTSP Client also states that there can be a lot of problems with the codec. (Section 4 in the link)

    I'd suggest to add and .stream and check. If that doesn't work then try a different codec.