Android - resume or resume video
I am writing a simple Android application with a class that extends an activity that plays a video from a URL on the internet. There is a button at the top that, when clicked, takes the user to a web page.
What I want to do, when the user is viewing the webpage, if he clicks the back button, I want him to go back to the main action and restart the video. Is there a way to do this?
Also, is there a way to resume the video from where it left off?
Thanks. Chris
+2
a source to share
2 answers
Try it.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_view);
videoView = (VideoView) findViewById(R.id.video_surface);
mc = new MediaController(this);
videoView.setMediaController(mc);
videoView.setVideoURI(Uri.parse("myUri"));
videoView.start();
}
@Override
public void onResume(){
super.onResume();
videoView.resume();
}
@Override
public void onPause(){
super.onPause();
videoView.suspend();
}
+2
a source to share