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!
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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.
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.