如何使用jQuery静音html5视频播放器 [英] How to mute an html5 video player using jQuery

查看:128
本文介绍了如何使用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

AND

$("video").prop('muted', false); //unmute

此处

(注意:如果在jQuery< 1.6中,请使用attr)

(side note: use attr if in jQuery < 1.6)

这篇关于如何使用jQuery静音html5视频播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆