A Pen by Jeroen van der Tuin on CodePen.
Created
April 5, 2014 03:45
-
-
Save wilvandertuin/9987223 to your computer and use it in GitHub Desktop.
A Pen by Jeroen van der Tuin.
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
<script src="https://www.youtube.com/iframe_api"></script> | |
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
(function() { | |
var initialize = function() { | |
console.log('initialize'); | |
var cid = 123; | |
var widget_id = 'YT_widget_' + cid; | |
$('body').append('<div id="' + widget_id + '" class="YT_widget"></div>'); | |
this.widget = new YT.UploadWidget(widget_id, { | |
width: 570, | |
events: { | |
'onApiReady': onApiReady, | |
'onStateChange': onStateChange | |
} | |
}); | |
}; | |
var onApiReady = function() { | |
console.log('onApiReady'); | |
}; | |
var onStateChange = function() { | |
console.log('onStateChange'); | |
}; | |
// On DOM ready. | |
$(function() { | |
window.onYouTubeIframeAPIReady = initialize; | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment