Skip to content

Instantly share code, notes, and snippets.

@casebeer
Created February 19, 2026 23:57
Show Gist options
  • Select an option

  • Save casebeer/6a4bb2d6ddae50ac44a022983b735c76 to your computer and use it in GitHub Desktop.

Select an option

Save casebeer/6a4bb2d6ddae50ac44a022983b735c76 to your computer and use it in GitHub Desktop.
console.log HTML5 <video> element lifecycle events.
const reportableEvents = [
'abort',
//'canplay',
//'canplaythrough',
//'durationchange',
'emptied',
'encrypted',
'ended',
'error',
'loadeddata',
'loadedmetadata',
'loadstart',
'pause',
//'play',
//'playing',
//'seeking',
//'stalled',
//'waiting',
'waitingforkey',
]
const reportEvent = (e) => {
console.log(e);
console.log(`currentSrc = '${e.target.currentSrc} ('${typeof e.target.currentSrc})`);
};
const reportEvents = (v) => {
for ( e of reportableEvents ) {
v.addEventListener(e, reportEvent);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment