I have set up a RTSP server using VLC. then I write an app,this is my code:
package com.ashley.work;
import android.os.Bundle;
import android.app.Activity;
import android.view.Menu;
import android.view.MenuItem;
import android.support.v4.app.NavUtils;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.VideoView;
public class TestPlayRTSP extends Activity {
Button playButton ;
VideoView videoView ;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_play_rtsp);
videoView = (VideoView)this.findViewById(R.id.myvideoview);
playButton = (Button)this.findViewById(R.id.button1);
playButton.setOnClickListener(new Button.OnClickListener(){
public void onClick(View v) {
PlayRtspStream("rtsp://140.xxx.xxx.xxx:8554/");
}
});
}
private void PlayRtspStream(String rtspUrl){
videoView.setVideoURI(Uri.parse(rtspUrl));
videoView.requestFocus();
videoView.start();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_test_play_rtsp, menu);
return true;
}
}
and I already set the permission. but this still can not play. nothing happend after I click the button. But if I replace the rtsp with other this two:
rtsp://218.204.223.237:554/live/1/66251FC11353191F/e7ooqwcfbqjoo80j.sdp
rtsp://v5.cache1.c.youtube.com/CjYLENy73wIaLQnhycnrJQ8qmRMYESARFEIJbXYtZ29vZ2xlSARSBXdhdGNoYPj_hYjnq6uUTQw=/0/0/0/video.3gp
the app will play correctly. can any one tell me why? and is there any solution to play the VLC stream???
thank you