diff options
Diffstat (limited to 'client/src/assets/player/shared/dock/peertube-dock-plugin.ts')
-rw-r--r-- | client/src/assets/player/shared/dock/peertube-dock-plugin.ts | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/client/src/assets/player/shared/dock/peertube-dock-plugin.ts b/client/src/assets/player/shared/dock/peertube-dock-plugin.ts new file mode 100644 index 000000000..245981692 --- /dev/null +++ b/client/src/assets/player/shared/dock/peertube-dock-plugin.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import videojs from 'video.js' | ||
2 | import { PeerTubeDockComponent } from './peertube-dock-component' | ||
3 | |||
4 | const Plugin = videojs.getPlugin('plugin') | ||
5 | |||
6 | export type PeerTubeDockPluginOptions = { | ||
7 | title?: string | ||
8 | description?: string | ||
9 | avatarUrl?: string | ||
10 | } | ||
11 | |||
12 | class PeerTubeDockPlugin extends Plugin { | ||
13 | constructor (player: videojs.Player, options: videojs.PlayerOptions & PeerTubeDockPluginOptions) { | ||
14 | super(player, options) | ||
15 | |||
16 | this.player.addClass('peertube-dock') | ||
17 | |||
18 | this.player.ready(() => { | ||
19 | this.player.addChild('PeerTubeDockComponent', options) as PeerTubeDockComponent | ||
20 | }) | ||
21 | } | ||
22 | } | ||
23 | |||
24 | videojs.registerPlugin('peertubeDock', PeerTubeDockPlugin) | ||
25 | export { PeerTubeDockPlugin } | ||