Last active
December 23, 2015 00:29
-
-
Save theodorocaliari/6554342 to your computer and use it in GitHub Desktop.
Play YouTube Video Muted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<body> | |
<div id="ytplayer"></div> | |
<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); | |
// Replace the 'ytplayer' element with an <iframe> and | |
// YouTube player after the API code downloads. | |
var player; | |
function onYouTubePlayerAPIReady() { | |
player = new YT.Player('ytplayer', { | |
width: '330', | |
height: '230', | |
videoId: 'jofNR_WkoCE', | |
playerVars: { | |
'wmode': 'opaque', | |
'autoplay': 1, | |
'controls': 0 , | |
'showinfo': 0, | |
//'start': 20, | |
'rel': 0, | |
'loop': 1, | |
}, | |
events:{ | |
'onReady':onPlayerReady | |
} | |
}); | |
} | |
function onPlayerReady(event) { | |
event.target.mute(); | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment