diff options
author | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-19 21:34:45 +0100 |
---|---|---|
committer | Rigel Kent <sendmemail@rigelk.eu> | 2019-12-19 21:34:45 +0100 |
commit | 1dc240a9488c66ad38205d08fcfdb32d35efceaa (patch) | |
tree | f97f41e367c52eaf55568f0d0cabf5c8444b86a4 /client/src/assets/player/videojs-components | |
parent | c5c09c1e5017844027ef77785f2d0406fa6b7039 (diff) | |
download | PeerTube-1dc240a9488c66ad38205d08fcfdb32d35efceaa.tar.gz PeerTube-1dc240a9488c66ad38205d08fcfdb32d35efceaa.tar.zst PeerTube-1dc240a9488c66ad38205d08fcfdb32d35efceaa.zip |
Add next video button to the player
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) | ||