@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(PLAYBACK_TIME, mVideoView.getCurrentPosition());
}
but onSaveInstanceState call comes after onPause, so mVideoView.getCurrentPosition() is 0.
I think it will be better:
@Override
protected void onPause() {
super.onPause();
currentPosition = videoView.getCurrentPosition();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
videoView.pause();
}
}
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putInt(PLAYBACK_TIME, currentPosition);
}