aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/playlist/playlist-plugin.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-05 09:44:58 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-08-07 08:58:29 +0200
commit4572c3d0d92f5b1b79b34dbe2c7b6557a8a5b7e4 (patch)
tree2c1aa81a536b50d6da0181aba6fce1db972f6191 /client/src/assets/player/playlist/playlist-plugin.ts
parent5abc96fca2496f33075796db208fccc3543e0f65 (diff)
downloadPeerTube-4572c3d0d92f5b1b79b34dbe2c7b6557a8a5b7e4.tar.gz
PeerTube-4572c3d0d92f5b1b79b34dbe2c7b6557a8a5b7e4.tar.zst
PeerTube-4572c3d0d92f5b1b79b34dbe2c7b6557a8a5b7e4.zip
Handle basic playlist in embed
Diffstat (limited to 'client/src/assets/player/playlist/playlist-plugin.ts')
-rw-r--r--client/src/assets/player/playlist/playlist-plugin.ts35
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 @@
1import videojs from 'video.js'
2import { PlaylistPluginOptions } from '../peertube-videojs-typings'
3import { PlaylistButton } from './playlist-button'
4import { PlaylistMenu } from './playlist-menu'
5
6const Plugin = videojs.getPlugin('plugin')
7
8class 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
34videojs.registerPlugin('playlist', PlaylistPlugin)
35export { PlaylistPlugin }