aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/shared/dock/peertube-dock-plugin.ts
blob: 245981692a2b2b2ee17e31ac49d6d45a050d3d07 (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
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 }