blob: bdb245dccfdb8e2d43a82a184d9ea64f1949aee0 (
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
32
33
34
35
36
37
|
import videojs, { VideoJsPlayer } from 'video.js'
const Button = videojs.getComponent('Button')
export interface NextVideoButtonOptions extends videojs.ComponentOptions {
handler: Function
}
class NextVideoButton extends Button {
private readonly nextVideoButtonOptions: NextVideoButtonOptions
constructor (player: VideoJsPlayer, options?: NextVideoButtonOptions) {
super(player, options)
this.nextVideoButtonOptions = options
}
createEl () {
const button = videojs.dom.createEl('button', {
className: 'vjs-next-video'
}) as HTMLButtonElement
const nextIcon = videojs.dom.createEl('span', {
className: 'icon icon-next'
})
button.appendChild(nextIcon)
button.title = this.player_.localize('Next video')
return button
}
handleClick () {
this.nextVideoButtonOptions.handler()
}
}
videojs.registerComponent('NextVideoButton', NextVideoButton)
|