Created
August 19, 2015 07:29
-
-
Save marcelowa/059f23dfc31bf1f340fe to your computer and use it in GitHub Desktop.
HTML5 Player events in an array formation
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
var elem = document.getElementById('some-player-element'); | |
[ | |
'abort', | |
'canplay', | |
'canplaythrough', | |
'durationchange', | |
'emptied', | |
'ended', | |
'error', | |
'loadeddata', | |
'loadedmetadata', | |
'loadstart', | |
'pause', | |
'play', | |
'playing', | |
'progress', | |
'ratechange', | |
'seeked', | |
'seeking', | |
'stalled', | |
'suspend', | |
'timeupdate', | |
'volumechange', | |
'waiting' | |
].forEach(function(eventName) { | |
elem.addEventListener(event, function (event) { | |
console.log('event triggered', eventName, event); | |
}, true); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment