如何使用声音自动播放视频如果可能的话,如果没有,请静音并显示按钮以取消静音?
我在BrightCove Player样本上需要类似的内容:带有Un Sture按钮的自动播放,但对于视频JS,而是用于视频。如何使用此代码执行此操作?
<div class="video-fallback"></div>
<video id="video" onloadstart="this.volume=0.6" loop="" autoplay="">
<source src="" type="video/mp4">
<script type="text/javascript">
var videos2 = [
'video4.mp4',
'video5.mp4',
'video6.mp4'
];
var count = Math.floor(Math.random() * videos2.length);
document.getElementsByTagName('source')[0].src = './videos/' + videos2[count];
</script>
</video>
I need something similar on Brightcove Player Sample: Autoplay with Unmute Button, but not for video-js, but for video. How to do this with this code?
<div class="video-fallback"></div>
<video id="video" onloadstart="this.volume=0.6" loop="" autoplay="">
<source src="" type="video/mp4">
<script type="text/javascript">
var videos2 = [
'video4.mp4',
'video5.mp4',
'video6.mp4'
];
var count = Math.floor(Math.random() * videos2.length);
document.getElementsByTagName('source')[0].src = './videos/' + videos2[count];
</script>
</video>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
?示例 html5覆盖大按钮。
作为给您想法的起点,您可以测试以下所示的代码:
( eg:在
视频上方上方的图层上的按钮(
z index
)。调查其他样式选项,例如位置
和top
和左
找到有助于解决问题的设置。You need to search for a tutorial: example html5 overlay big button.
As a starting point to give you ideas, you can test this code shown below:
(eg: test on W3Schools code previewer)...
It uses CSS Styling (see:
style=" "
) to put the "unmute" button on a layer (z-index
) above the video. Investigate the other style options likeposition
andtop
andleft
to find settings that help to fix your problem.