aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/videojs-components/next-video-button.ts
blob: bf5c1aba4ebd272ba437a3a1225b3ca9baf24009 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { VideoJSComponentInterface, videojsUntyped } from '../peertube-videojs-typings'
// FIXME: something weird with our path definition in tsconfig and typings
// @ts-ignore
import { Player } from 'video.js'

const Button: VideoJSComponentInterface = videojsUntyped.getComponent('Button')

class NextVideoButton extends Button {

  constructor (player: Player, options: any) {
    super(player, options)
  }

  createEl () {
    const button = videojsUntyped.dom.createEl('button', {
      className: 'vjs-next-video'
    })
    const nextIcon = videojsUntyped.dom.createEl('span', {
      className: 'icon icon-next'
    })
    button.appendChild(nextIcon)

    button.title = this.player_.localize('Next video')

    return button
  }

  handleClick () {
    this.options_.handler()
  }

}

NextVideoButton.prototype.controlText_ = 'Next video'

NextVideoButton.registerComponent('NextVideoButton', NextVideoButton)