Skip to content Skip to sidebar Skip to footer

Android: Videoview History/bookmark

I have a videoplayer application. Suppose the user has played a video and after playing half of the video, the user pressed the back button or exists the application. I want that p

Solution 1:

First, you will need to store this data in some database, but it's quite simple.

Now, you should add a check in the onPause() or onDestroy() method of your activity, which gets the position from the videoview:

publicvoidonPause() {
// ....int position = myVideoView.getCurrentPosition();
// store the position and file name (you should have it from before)
}

When you play a video, set the current position as stored before:

privatevoiddummyPlayVideo(String fileName) {
// ....
    int position = getSavedPositionOfVideo(fileName); // your method
    myVideoView.seekTo(position);
}

Post a Comment for "Android: Videoview History/bookmark"