我正在使用youtube的代码在我的网站上加载视频,但我找不到如何将音量静音。这可能吗?
<script>
// Load the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('ytplayer', {
height: '300',
width: '250',
autoplay : 1,
videoId: '5Wu9DxtyLWE',
events: {
"onReady": onPlayerReady,
"onStateChange": onPlayerStateChange
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
}
function onPlayerStateChange(event) {
if(event.data === 0) {
}
}
</script>
感谢大家。。
我找到了解决方案。。。很明显,我必须多读一些这方面的内容。。player.mute();