From 339632b4a3f94a6ebee3767054ef6c701858a785 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 12 Jan 2018 17:16:48 +0100 Subject: Fix changing video in watch page --- client/src/assets/player/peertube-videojs-plugin.ts | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'client/src/assets/player') 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' import { VideoFile } from '../../../../shared/models/videos/video.model' import { renderVideo } from './video-renderer' +declare module 'video.js' { + interface Player { + peertube (): PeerTubePlugin + } +} + interface VideoJSComponentInterface { - _player: VideoJSPlayer + _player: videojs.Player - new (player: VideoJSPlayer, options?: any) + new (player: videojs.Player, options?: any) registerComponent (name: string, obj: any) } -interface VideoJSPlayer extends videojs.Player { - peertube (): PeerTubePlugin -} - type PeertubePluginOptions = { videoFiles: VideoFile[] playerElement: HTMLVideoElement @@ -45,7 +47,7 @@ const webtorrent = new WebTorrent({ dht: false }) const MenuItem: VideoJSComponentInterface = videojsUntyped.getComponent('MenuItem') class ResolutionMenuItem extends MenuItem { - constructor (player: VideoJSPlayer, options) { + constructor (player: videojs.Player, options) { options.selectable = true super(player, options) @@ -64,7 +66,7 @@ const MenuButton: VideoJSComponentInterface = videojsUntyped.getComponent('MenuB class ResolutionMenuButton extends MenuButton { label: HTMLElement - constructor (player: VideoJSPlayer, options) { + constructor (player: videojs.Player, options) { options.label = 'Quality' super(player, options) @@ -215,7 +217,7 @@ class PeerTubePlugin extends Plugin { private videoFiles: VideoFile[] private torrent: WebTorrent.Torrent - constructor (player: VideoJSPlayer, options: PeertubePluginOptions) { + constructor (player: videojs.Player, options: PeertubePluginOptions) { super(player, options) this.videoFiles = options.videoFiles -- cgit v1.2.3