aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/stats/stats-plugin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/stats/stats-plugin.ts')
-rw-r--r--client/src/assets/player/stats/stats-plugin.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/client/src/assets/player/stats/stats-plugin.ts b/client/src/assets/player/stats/stats-plugin.ts
new file mode 100644
index 000000000..3402e7861
--- /dev/null
+++ b/client/src/assets/player/stats/stats-plugin.ts
@@ -0,0 +1,31 @@
1import videojs from 'video.js'
2import { StatsCard, StatsCardOptions } from './stats-card'
3
4const Plugin = videojs.getPlugin('plugin')
5
6class StatsForNerdsPlugin extends Plugin {
7 private statsCard: StatsCard
8
9 constructor (player: videojs.Player, options: Partial<StatsCardOptions> = {}) {
10 const settings = {
11 ...options
12 }
13
14 super(player)
15
16 this.player.ready(() => {
17 player.addClass('vjs-stats-for-nerds')
18 })
19
20 this.statsCard = new StatsCard(player, options)
21
22 player.addChild(this.statsCard, settings)
23 }
24
25 show (options?: StatsCardOptions) {
26 this.statsCard.show(options)
27 }
28}
29
30videojs.registerPlugin('stats', StatsForNerdsPlugin)
31export { StatsForNerdsPlugin }