diff options
Diffstat (limited to 'client/src/assets/player/playlist/playlist-plugin.ts')
-rw-r--r-- | client/src/assets/player/playlist/playlist-plugin.ts | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/client/src/assets/player/playlist/playlist-plugin.ts b/client/src/assets/player/playlist/playlist-plugin.ts new file mode 100644 index 000000000..b69d82e3c --- /dev/null +++ b/client/src/assets/player/playlist/playlist-plugin.ts | |||
@@ -0,0 +1,35 @@ | |||
1 | import videojs from 'video.js' | ||
2 | import { PlaylistPluginOptions } from '../peertube-videojs-typings' | ||
3 | import { PlaylistButton } from './playlist-button' | ||
4 | import { PlaylistMenu } from './playlist-menu' | ||
5 | |||
6 | const Plugin = videojs.getPlugin('plugin') | ||
7 | |||
8 | class PlaylistPlugin extends Plugin { | ||
9 | private playlistMenu: PlaylistMenu | ||
10 | private playlistButton: PlaylistButton | ||
11 | private options: PlaylistPluginOptions | ||
12 | |||
13 | constructor (player: videojs.Player, options?: PlaylistPluginOptions) { | ||
14 | super(player, options) | ||
15 | |||
16 | this.options = options | ||
17 | |||
18 | this.player.ready(() => { | ||
19 | player.addClass('vjs-playlist') | ||
20 | }) | ||
21 | |||
22 | this.playlistMenu = new PlaylistMenu(player, options) | ||
23 | this.playlistButton = new PlaylistButton(player, Object.assign({}, options, { playlistMenu: this.playlistMenu })) | ||
24 | |||
25 | player.addChild(this.playlistMenu, options) | ||
26 | player.addChild(this.playlistButton, options) | ||
27 | } | ||
28 | |||
29 | updateSelected () { | ||
30 | this.playlistMenu.updateSelected(this.options.getCurrentPosition()) | ||
31 | } | ||
32 | } | ||
33 | |||
34 | videojs.registerPlugin('playlist', PlaylistPlugin) | ||
35 | export { PlaylistPlugin } | ||