You can switch the videos by keeping two MediaPlayers and switching between them. You prepare the second one seek it and when the time is right you switch them out. The code below is for the same thing except I use it on user interaction. (you can ignore the AssetFileDesciptor as it's the way I open videos).
How can achieve the tagging for the video A for resuming from the previously paused time?
You can do a seekTo() to jump to a particular position. But the problem here is that you should wait for the seekTo() to complete. And Android does not provide such a callback for the VideoView.
So instead I suggest that you go for Vitamio's VideoView
发布评论
评论(2)
您可以通过保留两个媒体播放器并在它们之间切换来切换视频。
你准备第二个来寻找它,当时机成熟时你将它们切换出去。
下面的代码是用于相同的事情,只是我在用户交互中使用它。
(您可以忽略 AssetFileDeciptor,因为这是我打开视频的方式)。
You can switch the videos by keeping two MediaPlayers and switching between them.
You prepare the second one seek it and when the time is right you switch them out.
The code below is for the same thing except I use it on user interaction.
(you can ignore the AssetFileDesciptor as it's the way I open videos).
您可以执行
seekTo()
跳转到特定位置。但这里的问题是您应该等待seekTo()
完成。而Android并没有为VideoView提供这样的回调。因此,我建议您使用 Vitamio 的 VideoView
You can do a
seekTo()
to jump to a particular position. But the problem here is that you should wait for theseekTo()
to complete. And Android does not provide such a callback for the VideoView.So instead I suggest that you go for Vitamio's VideoView