问题描述
我想知道是否有完全证明的方式知道用户何时拖动HTML5视频的时间轴。到目前为止,我已经绑定到timeUpdate,但目前还不清楚当前时间是由于拖动还是仅仅是视频播放而增加。谢谢!
I was wondering if there is a full-proof way of knowing when the user is dragging the timeline of an HTML5 video. Thus far I've been binding to timeUpdate, but it's unclear whether the currentTime is increasing due to a drag or simply the video playing. Thanks!
推荐答案
我知道是一个html5视频元素实现,它支持一个名为'seeked'的事件,它可以为你提供你想要的东西。
I know that MediaElement.js which is a html5 video element implementation supports an event called 'seeked' which gives you what you want.
你可以使用它或者查看代码,看看他们用来检测搜索的逻辑是什么。
You could use that or look into the code to see what kind of logic they're using for detecting seeking.
另一种方法是你可以实现自己的自定义搜索栏,如果是这样,你就是只需处理用户拖动时间线擦洗器以引发搜索事件。 W3C有一个关于如何实施搜索的。
Another way is that you can implement your own custom seek bar and if that's the case, you can just handle when the user drags the timeline scrubber to throw up a seeked event. The W3C has a document on how to implement the seeking.
这篇关于HTML5视频:检测时间线的拖动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!