HTML5 Video: Detect dragging of timeline

白昼怎懂夜的黑 提交于 2019-12-13 06:51:34

问题


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.



来源:https://stackoverflow.com/questions/7946428/html5-video-detect-dragging-of-timeline

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!