Html5视频:无论如何我可以在最初几秒内禁用洗涤器吗?(Html5 Video : Is there anyway i can disable scrubber for during the fir

编程入门 行业动态 更新时间:2024-10-27 16:30:45
Html5视频:无论如何我可以在最初几秒内禁用洗涤器吗?(Html5 Video : Is there anyway i can disable scrubber for during the first few seconds?)

我有兴趣在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.

更多推荐

本文发布于:2023-08-07 14:37:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1464758.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:洗涤器   几秒   无论如何   最初   视频

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!