]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/assets/player/videojs-components/next-video-button.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / videojs-components / next-video-button.ts
... / ...
CommitLineData
1import videojs, { VideoJsPlayer } from 'video.js'
2
3const Button = videojs.getComponent('Button')
4
5export interface NextVideoButtonOptions extends videojs.ComponentOptions {
6 handler: Function
7}
8
9class NextVideoButton extends Button {
10 private readonly nextVideoButtonOptions: NextVideoButtonOptions
11
12 constructor (player: VideoJsPlayer, options?: NextVideoButtonOptions) {
13 super(player, options)
14
15 this.nextVideoButtonOptions = options
16 }
17
18 createEl () {
19 const button = videojs.dom.createEl('button', {
20 className: 'vjs-next-video'
21 }) as HTMLButtonElement
22 const nextIcon = videojs.dom.createEl('span', {
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 () {
33 this.nextVideoButtonOptions.handler()
34 }
35}
36
37videojs.registerComponent('NextVideoButton', NextVideoButton)