diff options
Diffstat (limited to 'client/src/assets/player/shared/upnext/upnext-plugin.ts')
-rw-r--r-- | client/src/assets/player/shared/upnext/upnext-plugin.ts | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/client/src/assets/player/shared/upnext/upnext-plugin.ts b/client/src/assets/player/shared/upnext/upnext-plugin.ts new file mode 100644 index 000000000..db969024d --- /dev/null +++ b/client/src/assets/player/shared/upnext/upnext-plugin.ts | |||
@@ -0,0 +1,31 @@ | |||
1 | import videojs from 'video.js' | ||
2 | import { EndCardOptions } from './end-card' | ||
3 | |||
4 | const Plugin = videojs.getPlugin('plugin') | ||
5 | |||
6 | class UpNextPlugin extends Plugin { | ||
7 | |||
8 | constructor (player: videojs.Player, options: Partial<EndCardOptions> = {}) { | ||
9 | const settings = { | ||
10 | next: options.next, | ||
11 | getTitle: options.getTitle, | ||
12 | timeout: options.timeout || 5000, | ||
13 | cancelText: options.cancelText || 'Cancel', | ||
14 | headText: options.headText || 'Up Next', | ||
15 | suspendedText: options.suspendedText || 'Autoplay is suspended', | ||
16 | condition: options.condition, | ||
17 | suspended: options.suspended | ||
18 | } | ||
19 | |||
20 | super(player) | ||
21 | |||
22 | this.player.ready(() => { | ||
23 | player.addClass('vjs-upnext') | ||
24 | }) | ||
25 | |||
26 | player.addChild('EndCard', settings) | ||
27 | } | ||
28 | } | ||
29 | |||
30 | videojs.registerPlugin('upnext', UpNextPlugin) | ||
31 | export { UpNextPlugin } | ||