Today we have discussed about video finish or playing video when then another activity start.
In complete video You have to put Listener for video properties.
This are the basic funda for playing video in android.
So this are the code below.
vd is the VideoView variable.
First of all pass uri.
Uri uri = Uri.parse("PATH OF VIDEO");
Then set media controller And set video uri ....
MediaController mc = new MediaController(this);
vd.setMediaController(mc);
vd.setVideoURI(uri);
vd.start();
Now On complete video setoncompletelistner properties on VideoView this code below....
vd.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
Log.v("log_tag","Complete Video");
}
});
2 comments:
what about if I want to start a new activity when the video completes?
I have a new intent identified, but the activity won't start. Everything in my manifest is laid out. I am stumped.
thanks, very useful post.
Rahul
Post a Comment