1
내 웹 사이트에서 음소거 된 동영상을 자동 재생하고 싶습니다. 작동하는 것처럼 보인 코드를 찾았지만 그렇지 않습니다. 왜이 자바 스크립트와 HTML 코드가 작동하지 않습니까? 테스트를 위해YouTube 자동 재생 (음소거 사용)
<div id="player"></div>
<script>
// 2. This code loads the IFrame Player API code asynchronously.
var tag = document.createElement('script');
tag.src = "http://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
// 3. This function creates an <iframe> (and YouTube player)
// after the API code downloads.
var player;
function onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
playerVars: { 'autoplay': 1, 'controls': 1,'autohide':1,'wmode':'opaque' },
videoId: 'RDfjXj5EGqI',
events: {
'onReady': onPlayerReady}
});
}
// 4. The API will call this function when the video player is ready.
function onPlayerReady(event) {
event.target.mute();
} </script>
jsFiddle : https://jsfiddle.net/qswpr8tL/
감사합니다!
YouTube API 문서를 확인할 수 있습니까? 'playerVars'에 추가 할 수있는 옵션이있을 것입니다. – evolutionxbox