new MediaElement('youtube1', {
success: function(media, domNode) {
// add HTML5 events to the YouTube API media object
media.addEventListener('play', function() {
console.log('yeah, it is playing!');
}, false);
media.addEventListener('timeupdate', function() {
// access HTML5-like properties
console.log('current: ' + media.currentTime);
}, false);
// add click events to control player
myMuteButton.addEventListener('click', function() {
// HTML5 has a "muted" setter, but we have to use a function here
media.setMuted(true);
}, false);
}
});