如何使用 jQuery 使 html5 视频播放器静音 [英] How to mute an html5 video player using jQuery
本文介绍了如何使用 jQuery 使 html5 视频播放器静音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经找到了如何使用 jquery 暂停和播放视频
I've found how to pause and play the video using jquery
$("video").get(0).play();
$("video").get(0).pause();
但是我找不到静音按钮,如果没有jquery解决方案,我只用onclick js解决方案就可以了.我需要尽快.
还有没有办法解决静音延迟?我希望它在点击按钮后立即静音/取消静音.
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
和
$("video").prop('muted', false); //unmute
在此处
(旁注:如果在 jQuery <1.6 中使用 attr
)
(side note: use attr
if in jQuery < 1.6)
这篇关于如何使用 jQuery 使 html5 视频播放器静音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文