Unable to Mute HTML5 Video Tag in Firefox

纵饮孤独 提交于 2019-12-05 00:08:49

I also came across this issue with Firefox, the simplest solution I've found is using the onloadedmetadata event as below:

video {
  width: 200px;
  height: 200px;
}
<video
  src="https://scontent-lhr3-1.cdninstagram.com/t50.2886-16/12930587_1020784647992081_252978711_n.mp4"
  muted
  onloadedmetadata="this.muted = true"
  onmouseenter="play()"
  onmouseleave="pause()"
  playsinline>

Note: There's a better answer in this question

I also had this problem in FF45. The solution was to set muted in code vs. the DOM.

$("#browserCheck").get(0)
<video id="browserCheck" class="img-responsive" autoplay="" muted="true">
$("#browserCheck").get(0).muted
false
$("#browserCheck").get(0).muted = true
true
$("#browserCheck").get(0).muted
true

I've had trouble muting video with Firefox, too. No problem in Chrome. I worked around the Firefox issue by setting the volume to zero. Same net effect?

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