如何静音html5视频播放器 [英] How to mute an html5 video player
本文介绍了如何静音html5视频播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经找到了如何使用jquery暂停和播放视频
$(视频)获得(0).play();
$(video)。get(0).pause();
但是我找不到静音按钮,如果没有jQuery解决方案,只需一个onclick js解决方案就可以了。
我需要它。
也有解决静音延迟的方法吗?我希望它在按钮被点击后静音/取消静音。
解决方案
$(video)。prop('muted',true); //静音
AND
$(video)。prop('muted',false); //取消静音
查看所有活动此处
(旁注:使用 attr
如果在jQuery中< 1.6)
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 the mute button, if there isn't a jquery solution, I'm fine with just an onclick js solution. I need it asap.
Also is there a way to fix the mute delay? I want it to mute/unmute the sound as soon as the button is clicked.
解决方案
$("video").prop('muted', true); //mute
AND
$("video").prop('muted', false); //unmute
See all events here
(side note: use attr
if in jQuery < 1.6)
这篇关于如何静音html5视频播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文