Created
January 3, 2015 09:48
-
-
Save clonn/f3a2966f48f69db9f2dc to your computer and use it in GitHub Desktop.
youtube-player.coffee, for controller, should be install and use, could not insert before.
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
(($) -> | |
options = | |
videoId: "youtube video id" | |
width: "640" | |
height: "480" | |
playerVars: | |
autoplay: 0 | |
controls: 1 | |
modestbranding: 0 | |
rel: 0 | |
showInfo: 0 | |
events: | |
onStateChange: (state) -> | |
$.fancybox(href: "#fill") if state.data is YT.PlayerState.ENDED | |
return | |
if typeof (YT) is "undefined" or typeof (YT.Player) is "undefined" | |
window.onYouTubePlayerAPIReady = -> | |
#div id | |
window.player = new YT.Player("video", options) | |
return | |
# window .player.addEventListener("onStateChange", "hello"); | |
$.getScript "//www.youtube.com/player_api" | |
else | |
window.player = new YT.Player("video", options) | |
) jQuery |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment