如何检查视频是否播放完毕?(How to check whether video gets finished playing or not?)

编程入门 行业动态 更新时间:2024-10-26 22:26:24
如何检查视频是否播放完毕?(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!!

更多推荐

本文发布于:2023-08-06 07:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1445273.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:视频   check   video   finished   playing

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!