Created
March 23, 2015 19:55
-
-
Save transitive-bullshit/65697003b888bf7877dc to your computer and use it in GitHub Desktop.
youtube
This file contains 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> | |
<head> | |
<meta name="viewport" content="user-scalable=no, minimum-scale=1.0, initial-scale=1.0"> | |
<style> | |
body { margin: 0 0; padding: 0 0; width: 100%; height: 100%; min-height: 100%; background: #000; } | |
#player { width: 100%; height: 100%; min-height: 100%; } | |
</style> | |
</head> | |
<body class="flex"> | |
<div id="player"></div> | |
<script> | |
var tag = document.createElement('script'); | |
tag.src = 'http://www.youtube.com/player_api'; | |
var firstScriptTag = document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
var PLAYER_ID = %d; | |
var player; | |
function onYouTubePlayerAPIReady () { | |
player = new YT.Player('player', { | |
width:'100%%', | |
height:'100%%', | |
videoId:'%@', | |
playerVars: { | |
playsinline: 1, | |
controls: 0, | |
modestbranding: 1, | |
showinfo: 0, | |
loop: 1, | |
fs: 0, | |
disablekb: 1, | |
autohide: 1, | |
autoplay: 0, | |
enablejsapi: 1 | |
}, | |
events: { | |
onReady: onPlayerReady, | |
onStateChange: function (event) { | |
window.webkit.messageHandlers.observe.postMessage({ player: PLAYER_ID, event: "state", state: event.data }); | |
} | |
} | |
}); | |
} | |
function onPlayerReady (event) { | |
window.webkit.messageHandlers.observe.postMessage({ player: PLAYER_ID, event: "ready" }); | |
} | |
function play () { | |
if (player) { | |
player.playVideo(); | |
} | |
} | |
function pause () { | |
if (player) { | |
player.pauseVideo(); | |
} | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
User given Player id '%d'( var PLAYER_ID = %d;),
am given that my channel id it showing error