blob: db969024deb7bbdb324c87d9cf2b0305d37f2fc9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
import videojs from 'video.js'
import { EndCardOptions } from './end-card'
const Plugin = videojs.getPlugin('plugin')
class UpNextPlugin extends Plugin {
constructor (player: videojs.Player, options: Partial<EndCardOptions> = {}) {
const settings = {
next: options.next,
getTitle: options.getTitle,
timeout: options.timeout || 5000,
cancelText: options.cancelText || 'Cancel',
headText: options.headText || 'Up Next',
suspendedText: options.suspendedText || 'Autoplay is suspended',
condition: options.condition,
suspended: options.suspended
}
super(player)
this.player.ready(() => {
player.addClass('vjs-upnext')
})
player.addChild('EndCard', settings)
}
}
videojs.registerPlugin('upnext', UpNextPlugin)
export { UpNextPlugin }
|