diff options
Diffstat (limited to 'client/src/assets/player/videojs-components')
-rw-r--r-- | client/src/assets/player/videojs-components/next-video-button.ts | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/client/src/assets/player/videojs-components/next-video-button.ts b/client/src/assets/player/videojs-components/next-video-button.ts new file mode 100644 index 000000000..bf5c1aba4 --- /dev/null +++ b/client/src/assets/player/videojs-components/next-video-button.ts | |||
@@ -0,0 +1,36 @@ | |||
1 | import { VideoJSComponentInterface, videojsUntyped } from '../peertube-videojs-typings' | ||
2 | // FIXME: something weird with our path definition in tsconfig and typings | ||
3 | // @ts-ignore | ||
4 | import { Player } from 'video.js' | ||
5 | |||
6 | const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button') | ||
7 | |||
8 | class NextVideoButton extends Button { | ||
9 | |||
10 | constructor (player: Player, options: any) { | ||
11 | super(player, options) | ||
12 | } | ||
13 | |||
14 | createEl () { | ||
15 | const button = videojsUntyped.dom.createEl('button', { | ||
16 | className: 'vjs-next-video' | ||
17 | }) | ||
18 | const nextIcon = videojsUntyped.dom.createEl('span', { | ||
19 | className: 'icon icon-next' | ||
20 | }) | ||
21 | button.appendChild(nextIcon) | ||
22 | |||
23 | button.title = this.player_.localize('Next video') | ||
24 | |||
25 | return button | ||
26 | } | ||
27 | |||
28 | handleClick () { | ||
29 | this.options_.handler() | ||
30 | } | ||
31 | |||
32 | } | ||
33 | |||
34 | NextVideoButton.prototype.controlText_ = 'Next video' | ||
35 | |||
36 | NextVideoButton.registerComponent('NextVideoButton', NextVideoButton) | ||