linsea / UniversalVideoView

A better Android VideoView with more Media Controller customization. 一个更好用的Android VideoView
https://github.com/linsea/UniversalVideoView
992 stars 272 forks source link

How to check end time of video when video is pause and activity pause,destroyed,stop #42

Closed rssumit closed 6 years ago

rssumit commented 6 years ago

How to check end time of video when the video is pause and activity pause, destroyed, stop. When the user starts the video, if he pauses the video and go back(pause, stop, destroyed activity,pause video).after this video should start from last timestamp.

linsea commented 6 years ago

see the sample: save your video position on protected void onSaveInstanceState(Bundle outState); and when user back, on public void onStart(MediaPlayer mediaPlayer) seek to the saved position :

    @Override
    public void onStart(MediaPlayer mediaPlayer) {
        Log.d(TAG, "onStart UniversalVideoView callback");
        mVideoView.seekTo(mSeekPosition);  // seek to the saved position
    }