Skip to content

Instantly share code, notes, and snippets.

@gkweb
Last active November 17, 2016 00:49
Show Gist options
  • Save gkweb/f609cc05555fc07d4a59fe0c64360675 to your computer and use it in GitHub Desktop.
Save gkweb/f609cc05555fc07d4a59fe0c64360675 to your computer and use it in GitHub Desktop.
HTML 5 Video debug events
// Debug HTML5 Video or Audio events
// Assign multiple events
let media = document.getElementById('somevideo')
'canplay canplaythrough durationchange emptied error loadstart loadedmetadata playing pause seeked suspend stalled timeupdate volumechange waiting'.split(' ').forEach(e => {
media.addEventListener(e, event => {
console.log('Event fired')
console.log(event.type)
console.log(event)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment