在本示例中,視頻在暫停時停留在最後一幀,永遠不會再次啓動。它永遠不會進入setOnPreparedListener內部。如何在videoview中暫停呼叫後恢復視頻android
public void pauseVideo(){
videoPos=videoView.getCurrentPosition();
Log.w("Video Position", Integer.toString(videoPos));
isVideoPaused=true;
videoView.pause();
}
public void resumeVideo(){
Log.w("Video Pos in resume", Integer.toString(videoPos));
videoView.seekTo(videoPos);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
Log.w("Inside on prepared","finally inside");
mp.setOnSeekCompleteListener(new MediaPlayer.OnSeekCompleteListener() {
@Override
public void onSeekComplete(MediaPlayer mp) {
Log.w("Inside on seek complete","finally inside");
videoView.start();
}
});
}
});
}
你想實現與這段代碼是什麼? – hardartcore
我想從暫停的位置恢復視頻。 – nick9999