aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/assets/player/videojs-components/next-video-button.ts
blob: 22b32f06b93516993d6f4feb7e19f80723af68b2 (plain) (tree)
1
2
3
4
5
6
7
8
9
                              
 




                                                                          

                                      
                                                                 
 
                                                                          
                          

                                         


               
                                                   
                                 

                                                   









                                                      
                                         
   

 
                                                             
import videojs from 'video.js'

const Button = videojs.getComponent('Button')

export interface NextVideoButtonOptions extends videojs.ComponentOptions {
  handler: Function
}

class NextVideoButton extends Button {
  private readonly nextVideoButtonOptions: NextVideoButtonOptions

  constructor (player: videojs.Player, options?: NextVideoButtonOptions) {
    super(player, options)

    this.nextVideoButtonOptions = options
  }

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

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

    return button
  }

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

videojs.registerComponent('NextVideoButton', NextVideoButton)