Last active
November 12, 2024 20:35
-
-
Save alexrqs/a6db03bade4dc405a61c63294a64f97a to your computer and use it in GitHub Desktop.
VideoJS event list
This file contains 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
// The events are from https://www.w3.org/TR/html5/semantics-embedded-content.html#media-elements-event-summary | |
import videojs from 'video.js' | |
const Plugin = videojs.getPlugin('plugin') | |
const EVENTS = [ | |
'loadstart', | |
'progress', | |
'suspend', | |
'abort', | |
'error', | |
'emptied', | |
'stalled', | |
'loadedmetadata', | |
'loadeddata', | |
'canplay', | |
'canplaythrough', | |
'playing', | |
'waiting', | |
'seeking', | |
'seeked', | |
'ended', | |
'durationchange', | |
'timeupdate', | |
'play', | |
'pause', | |
'ratechange', | |
'resize', | |
'volumechange', | |
] | |
class EventLogger extends Plugin { | |
constructor(player) { | |
super(player) | |
this.on(player, EVENTS, this.logEvents) | |
} | |
logEvents(event) { | |
videojs.log(event) | |
} | |
/** | |
* This function stops the plugin on dispose | |
*/ | |
dispose() { | |
super.dispose() | |
videojs.log('the EventLogger plugin is being disposed') | |
} | |
} | |
export default EventLogger | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
good this one!