标题几乎说明了一切.我有一个视频,当到达页面时自动开始播放.
在HTML代码中我把muted ="muted".这是奇怪的部分.当看着控制器时,它显然是静音的,但音乐仍在播放,可以听到.即使我在W3Schools上查看HTML5视频示例,它也会在静音时播放音乐.
有没有办法,例如通过jQuery绕过这个?我有一个jQuery线,坚持视频静音,但没有效果.
这是HTML代码使用:
<video id="video" width="640px" height="350px" autoplay="autoplay" loop="loop" controls="controls" muted="muted">
<source src="intouchables.f4v" type="video/mp4">
Your browser does not support the video tag.
</video>
Run Code Online (Sandbox Code Playgroud)
希望你能帮助我.jQuery行如下:
$("video").prop('muted',true);
提前致谢.
我创建了一个带静音的简单视频块(用于移动自动启动),但现在我无法改变静音状态......
我使用那个存储库,小提琴链接会很棒.
到目前为止,我已经尝试过,没有运气.
HTML
<video width="640" height="264" muted autoplay webkit-playsinline src="'+videoURL+'"></video>'
Run Code Online (Sandbox Code Playgroud)
JS
$(document).on("click",".containerVolume",function(e){
if(isMuted){
$('video').prop('muted', false);
}
else{
$('video').prop('muted',true);
}
});
var videos = document.querySelectorAll('video');
if (location.search === '?enabled=false')
{
} else if (location.search === '?enabled=true') {
enableVideos(false);
} else {
enableVideos();
}
function enableVideos(everywhere) {
for (var i = 0; i < videos.length; i++) {
window.makeVideoPlayableInline(videos[i], !videos[i].hasAttribute('muted'), !everywhere);
}
}
Run Code Online (Sandbox Code Playgroud)