aboutsummaryrefslogblamecommitdiffhomepage
path: root/client/src/assets/player/shared/dock/peertube-dock-plugin.ts
blob: 245981692a2b2b2ee17e31ac49d6d45a050d3d07 (plain) (tree)
























                                                                                                    
import videojs from 'video.js'
import { PeerTubeDockComponent } from './peertube-dock-component'

const Plugin = videojs.getPlugin('plugin')

export type PeerTubeDockPluginOptions = {
  title?: string
  description?: string
  avatarUrl?: string
}

class PeerTubeDockPlugin extends Plugin {
  constructor (player: videojs.Player, options: videojs.PlayerOptions & PeerTubeDockPluginOptions) {
    super(player, options)

    this.player.addClass('peertube-dock')

    this.player.ready(() => {
      this.player.addChild('PeerTubeDockComponent', options) as PeerTubeDockComponent
    })
  }
}

videojs.registerPlugin('peertubeDock', PeerTubeDockPlugin)
export { PeerTubeDockPlugin }