我有兴趣在HTML5中构建自定义视频播放器。 我没有嵌入html5视频媒体的问题,只是想弄清楚如何禁用擦洗器几秒钟,之后应该启用其他控件? 试过几个例子,但没有什么帮助我。
I'm interested in building a custom video player in HTML5. I have no problem embedding html5 video media, just trying figure out how I can disable the scrubber for few seconds and after that other controls should be enabled? Tried few examples but nothing helped me much.
最满意答案
像这样的东西应该工作:
videoElement.onplay = function() { setTimeout(function() { videoElement.controls = true; }, 3000); };当然,如果没有控件显示你需要一种方法来启动视频。 如果您启用了autoplay属性,它将自动启动,或者您可以调用videoElement.play()以响应某些事件(例如单击自定义播放按钮)。
如果您希望禁用控件但仍然可视化显示,则可能需要创建自定义控件并使用相同的onplay / setTimeout技术来启用它们。
Something like this should work:
videoElement.onplay = function() { setTimeout(function() { videoElement.controls = true; }, 3000); };Of course, without the controls showing you would need a way to start the video. If you have the autoplay attribute on, it would start automatically, or you could call videoElement.play() in response to some event (like clicking a custom play button).
If you want the controls to be disabled but still show up visually, you probably need to create custom controls and use the same onplay/setTimeout technique to enable them.
更多推荐
发布评论