How to mute an html5 video player using jQuery

后端 未结 3 1646
刺人心
刺人心 2020-11-27 17:23

I\'ve found how to pause and play the video using jquery

$(\"video\").get(0).play();
$(\"video\").get(0).pause();

But I can\'t find t

3条回答
  •  庸人自扰
    2020-11-27 17:58

    Are you using the default controls boolean attribute on the video tag? If so, I believe all the supporting browsers have mute buttons. If you need to wire it up, set .muted to true on the element in javascript (use .prop for jquery because it's an IDL attribute.) The speaker icon on the volume control is the mute button on chrome,ff, safari, and opera for example

提交回复
热议问题