i've got this simple video stream player:
if (play) {
myVideoView.stopPlayback();
myVideoView.clearFocus();
myVideoView = null;
button5.setText("Start");
play = false;
} else {
// dialog = ProgressDialog.show(Main.this, "Feldolgozás",
// "A videó töltődik");
progressBar = new ProgressDialog(v.getContext());
progressBar.setCancelable(true);
progressBar.setMessage("A video töltődik ...");
progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
progressBar.setProgress(0);
progressBar.setMax(100);
progressBar.show();
myVideoView = (VideoView) findViewById(R.id.myvideoview);
myVideoView.setVideoURI(Uri.parse(SrcPath));
RelativeLayout.LayoutParams videoviewlp = new RelativeLayout.LayoutParams(
500, 480);
videoviewlp.addRule(RelativeLayout.CENTER_HORIZONTAL,
RelativeLayout.TRUE);
videoviewlp.addRule(RelativeLayout.CENTER_VERTICAL,
RelativeLayout.TRUE);
myVideoView.setLayoutParams(videoviewlp);
myVideoView.invalidate();
myVideoView.requestFocus();
myVideoView.setOnPreparedListener(new OnPreparedListener() {
public void onPrepared(MediaPlayer mp) {
// mp.setOnCompletionListener(this);
mp.setOnBufferingUpdateListener(new OnBufferingUpdateListener() {
public void onBufferingUpdate(
MediaPlayer mPlayer, int percent) {
progressBar.setProgress(percent);
if (percent == 100) {
//dialog.dismiss();
progressBar.dismiss();
// Toast.makeText(getApplicationContext(),
// "100%", Toast.LENGTH_LONG).show();
}
}
});
mp.start();
// myVideoView.start();
}
});
play = true;
button5.setText("Stop");
}
}
How can i check if the video stream has ended or lost? If lost the button should change to start and stop the videoview... tanks for your aswers!
update: i think the problem is with the vlc rtsp stream because it says when the youtube rtsp is ended...