我一直在研究如何在Android中使用VideoView播放视频。
在片段的OnPause中,我会暂停视频并存储当前的播放进度。
@Override
public void onPause() {
super.onPause();
if (videoview != null && videoview.isPlaying()) {
videoview.pause();
seekTime = videoview.getCurrentPosition();
}
}
在OnResume中,我正在尝试使用以下方法恢复视频 -
@Override
public void onResume() {
super.onResume();
videoview.seekTo(seekTime);
//vvOnboardingVideos.resume();// this is not working for now - need to investigate
videoview.start();
}
视频从开头播放。
我有什么做错了吗?请给出建议。