]>
Commit | Line | Data |
---|---|---|
512decf3 | 1 | import videojs from 'video.js' |
1dc240a9 | 2 | |
f5fcd9f7 C |
3 | const Button = videojs.getComponent('Button') |
4 | ||
5 | export interface NextVideoButtonOptions extends videojs.ComponentOptions { | |
6 | handler: Function | |
7 | } | |
1dc240a9 RK |
8 | |
9 | class NextVideoButton extends Button { | |
f5fcd9f7 | 10 | private readonly nextVideoButtonOptions: NextVideoButtonOptions |
1dc240a9 | 11 | |
7e37e111 | 12 | constructor (player: videojs.Player, options?: NextVideoButtonOptions) { |
1dc240a9 | 13 | super(player, options) |
f5fcd9f7 C |
14 | |
15 | this.nextVideoButtonOptions = options | |
1dc240a9 RK |
16 | } |
17 | ||
18 | createEl () { | |
f5fcd9f7 | 19 | const button = videojs.dom.createEl('button', { |
1dc240a9 | 20 | className: 'vjs-next-video' |
f5fcd9f7 C |
21 | }) as HTMLButtonElement |
22 | const nextIcon = videojs.dom.createEl('span', { | |
1dc240a9 RK |
23 | className: 'icon icon-next' |
24 | }) | |
25 | button.appendChild(nextIcon) | |
26 | ||
27 | button.title = this.player_.localize('Next video') | |
28 | ||
29 | return button | |
30 | } | |
31 | ||
32 | handleClick () { | |
f5fcd9f7 | 33 | this.nextVideoButtonOptions.handler() |
1dc240a9 | 34 | } |
1dc240a9 RK |
35 | } |
36 | ||
f5fcd9f7 | 37 | videojs.registerComponent('NextVideoButton', NextVideoButton) |