aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-plugin.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/peertube-videojs-plugin.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-plugin.ts20
1 files changed, 11 insertions, 9 deletions
diff --git a/client/src/assets/player/peertube-videojs-plugin.ts b/client/src/assets/player/peertube-videojs-plugin.ts
index 34c993f3c..0a7651a81 100644
--- a/client/src/assets/player/peertube-videojs-plugin.ts
+++ b/client/src/assets/player/peertube-videojs-plugin.ts
@@ -5,18 +5,20 @@ import * as WebTorrent from 'webtorrent'
5import { VideoFile } from '../../../../shared/models/videos/video.model' 5import { VideoFile } from '../../../../shared/models/videos/video.model'
6import { renderVideo } from './video-renderer' 6import { renderVideo } from './video-renderer'
7 7
8declare module 'video.js' {
9 interface Player {
10 peertube (): PeerTubePlugin
11 }
12}
13
8interface VideoJSComponentInterface { 14interface VideoJSComponentInterface {
9 _player: VideoJSPlayer 15 _player: videojs.Player
10 16
11 new (player: VideoJSPlayer, options?: any) 17 new (player: videojs.Player, options?: any)
12 18
13 registerComponent (name: string, obj: any) 19 registerComponent (name: string, obj: any)
14} 20}
15 21
16interface VideoJSPlayer extends videojs.Player {
17 peertube (): PeerTubePlugin
18}
19
20type PeertubePluginOptions = { 22type PeertubePluginOptions = {
21 videoFiles: VideoFile[] 23 videoFiles: VideoFile[]
22 playerElement: HTMLVideoElement 24 playerElement: HTMLVideoElement
@@ -45,7 +47,7 @@ const webtorrent = new WebTorrent({ dht: false })
45const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') 47const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem')
46class ResolutionMenuItem extends MenuItem { 48class ResolutionMenuItem extends MenuItem {
47 49
48 constructor (player: VideoJSPlayer, options) { 50 constructor (player: videojs.Player, options) {
49 options.selectable = true 51 options.selectable = true
50 super(player, options) 52 super(player, options)
51 53
@@ -64,7 +66,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB
64class ResolutionMenuButton extends MenuButton { 66class ResolutionMenuButton extends MenuButton {
65 label: HTMLElement 67 label: HTMLElement
66 68
67 constructor (player: VideoJSPlayer, options) { 69 constructor (player: videojs.Player, options) {
68 options.label = 'Quality' 70 options.label = 'Quality'
69 super(player, options) 71 super(player, options)
70 72
@@ -215,7 +217,7 @@ class PeerTubePlugin extends Plugin {
215 private videoFiles: VideoFile[] 217 private videoFiles: VideoFile[]
216 private torrent: WebTorrent.Torrent 218 private torrent: WebTorrent.Torrent
217 219
218 constructor (player: VideoJSPlayer, options: PeertubePluginOptions) { 220 constructor (player: videojs.Player, options: PeertubePluginOptions) {
219 super(player, options) 221 super(player, options)
220 222
221 this.videoFiles = options.videoFiles 223 this.videoFiles = options.videoFiles