我正在尝试为自动播放的视频添加静音按钮。我从HTML5模板构建了网站。
https://cmsonline.com/overview/index.html
<div class="swiper-slide overlay overlay-grid-2">
<video src="img/slides/overview.mp4" width="640" height="360" loop></video>
</div>
<div id="thumbnail_a">Mute Video</div>
答案 0 :(得分:0)
您可以尝试按标签名称抓取视频元素,然后告诉它将muted设置为true,如果muted设置为false并且muted设置为false则将其设置为true。
<div class="swiper-slide overlay overlay-grid-2">
<video src="https://cmsonline.com/overview/img/slides/overview.mp4" width="640" height="360" autoplay></video>
<h1> </h1>
</div>
<div id="thumbnail_a" onclick="document.getElementsByTagName('video')[0].muted = (document.getElementsByTagName('video')[0].muted == false) ? true:false;">Mute Video
</div>