如何检查视频是否播放完毕?(How to check whether video gets finished playing or not?)
我有一个问题,我想检查视频是否全部播放完毕。 意味着我们想要一个视频获得完全播放的状态意味着它到达视频的末尾。
给我任何与此问题相关的建议。
提前致谢。
I have a problem that I want to check whether a video gets all finished playing or not. Means we want a state where video gets all finished playing means it reached to the end of the video.
Give me any suggestion related to this problem.
Thanks in advance.
最满意答案
在您的活动中实现OnCompletionListener ,如下所示:
public class VideoPlayer extends Activity implements OnCompletionListener{当你实现这个时,eclipse会在你的类中添加一个新的方法“ onCompletion ”:
@Override public void onCompletion(MediaPlayer mp) { //video playback has ended, now do whatever you want to do. }在此之后为您的视频视图设置onCompletionListener,如下所示:
mVideoView.setOnCompletionListener(VideoDisplayView.this);希望这可以帮助!!
Implement OnCompletionListener in your activity like this:
public class VideoPlayer extends Activity implements OnCompletionListener{when you will implement this, eclipse will add a new method "onCompletion" in your class:
@Override public void onCompletion(MediaPlayer mp) { //video playback has ended, now do whatever you want to do. }after this set the onCompletionListener for your videoview like this:
mVideoView.setOnCompletionListener(VideoDisplayView.this);Hope this helps!!
更多推荐
发布评论