1 import videojs, { VideoJsPlayer } from 'video.js'
2 import { EndCardOptions } from './end-card'
4 const Plugin = videojs.getPlugin('plugin')
6 class UpNextPlugin extends Plugin {
8 constructor (player: VideoJsPlayer, options: Partial<EndCardOptions> = {}) {
11 getTitle: options.getTitle,
12 timeout: options.timeout || 5000,
13 cancelText: options.cancelText || 'Cancel',
14 headText: options.headText || 'Up Next',
15 suspendedText: options.suspendedText || 'Autoplay is suspended',
16 condition: options.condition,
17 suspended: options.suspended
22 this.player.ready(() => {
23 player.addClass('vjs-upnext')
26 player.addChild('EndCard', settings)
30 videojs.registerPlugin('upnext', UpNextPlugin)
31 export { UpNextPlugin }