Forked from alexrqs/videojs-plugin-events-logger.js
Created
December 13, 2022 22:05
-
-
Save onigetoc/ce9f3b4e5307c6d1c9bdffea5c0054ea 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