android: onSeekCompleteListener 与 VideoView
我正在使用 VideoView 播放视频文件。我正在使用eekTo函数来从中断的地方播放视频。但是,我想在查找操作完成后执行一些操作。为此,我需要使用 onSeekCompleteListener;但是,VideoView 不支持 onSeekCompleteListener;它可以与 MediaPlayer 一起使用。我的问题是“有什么方法可以将 onSeekCompleteListener 与 VideoView 一起使用吗?”
多谢
I am using VideoView to play video files. I am using seekTo function in order to play the video from where it has been left off. However, I wanted to do some operations when the seek operation is finished. For that I need to use onSeekCompleteListener; however, onSeekCompleteListener is not supported with VideoView; it can be used with MediaPlayer. My Question is that "is there any way by which I can use onSeekCompleteListener" with VideoView?
Thanks alot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
无需创建自定义
VideoView
。您可以从
VideoView
的onPrepared
方法访问MediaPlayer
,然后设置OnSeekCompleteListener
,如下所示:There is no need to create a custom
VideoView
.You can access the
MediaPlayer
from theonPrepared
method of theVideoView
and then set theOnSeekCompleteListener
, like this :}
你可以监听这样的事件
:
}
you can listen for events like this:
}
Farhan,你是对的,VideoView 不支持 onSeekCompleteListener。
但您可以复制并本地自定义 VideoView 类以自行添加此支持。
我在我对7990784的回答。
Farhan, you are correct, onSeekCompleteListener is not supported by VideoView.
But you can copy and locally customize the VideoView class to add this support yourself.
I show how to do this in my answer to 7990784.