]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - 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
f5fcd9f7 1import videojs, { VideoJsPlayer } from 'video.js'
1dc240a9 2
f5fcd9f7
C
3const Button = videojs.getComponent('Button')
4
5export interface NextVideoButtonOptions extends videojs.ComponentOptions {
6 handler: Function
7}
1dc240a9
RK
8
9class NextVideoButton extends Button {
f5fcd9f7 10 private readonly nextVideoButtonOptions: NextVideoButtonOptions
1dc240a9 11
f5fcd9f7 12 constructor (player: VideoJsPlayer, 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 37videojs.registerComponent('NextVideoButton', NextVideoButton)