Search code examples
androidrtsplive-streaming

RTSP streaming in android


Here is my code, and when I run the app, it will display "Sorry this video cannot be played".

public class rtspActivity extends Activity {

    Button btn;
    VideoView v;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_rtsp);
        v=(VideoView)findViewById(R.id.vv);

        v.setVideoURI(Uri.parse("rtsp://server.intelcast.tv:554/live/haditvfour1"));

    }

 }

Solution

  • You should start with

    v.setMediaController(new MediaController(this));
    v.requestFocus();
    v.start();
    

    Also, the url you're using might not be good. Try it in VLC or similar, to see if its actually there

    Another problem can be the "server.intelcast.tv:554" part, try replacing this with a real ip adress with numbers, i've experinced this issue myself