Created
February 19, 2026 23:57
-
-
Save casebeer/6a4bb2d6ddae50ac44a022983b735c76 to your computer and use it in GitHub Desktop.
console.log HTML5 <video> element lifecycle events.
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
| 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