我是android新手。我正在开发一个在线电视应用程序。问题是我只能播放一些rtsp和http视频扩展名为.3gp和.mp4但不是全部,其他rtsp和http链接不支持(.sdp链接)。我正在使用videoview.please帮我做什么 如果这是视频播放器的问题,那么在我的代码中应该添加哪个播放器是我的代码。
enter code here
ProgressDialog pDialog;
VideoView videoview;
// Insert your Video URL3gp
String VideoURL = "rtsp://69.1.72.29:1935/jadooplus/stream0042.stream";
// String VideoURL = "rtsp://46.249.213.93:554/playlists/wild_life_qcif.hpl.3gp";
//String VideoURL = "http://tv.easy.pk/live_Geo_News_Pakistan-83-17-1.html";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the layout from video_main.xml
setContentView(R.layout.videoview);
videoview=(VideoView) findViewById(R.id.VView);
// Find your VideoView in your video_main.xml layout
// Execute StreamVideo AsyncTask
// Create a progressbar
pDialog = new ProgressDialog(VideoViewActivity.this);
// Set progressbar title
pDialog.setTitle("Loading channel");
// Set progressbar message
pDialog.setMessage("Buffering...");
pDialog.setIndeterminate(false);
pDialog.setCancelable(false);
// Show progressbar
pDialog.show();
try {
// Start the MediaController
MediaController mediacontroller = new MediaController(
VideoViewActivity.this);
mediacontroller.setAnchorView(videoview);
// Get the URL from String VideoURL
Uri video = Uri.parse(VideoURL);
videoview.setMediaController(mediacontroller);
videoview.setVideoURI(video);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
videoview.requestFocus();
videoview.setOnPreparedListener(new OnPreparedListener() {
// Close the progress bar and play the video
public void onPrepared(MediaPlayer mp) {
pDialog.dismiss();
videoview.start();
// mp.start();
指导我!