aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-player-manager.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-17 11:20:12 +0200
committerChocobozzz <me@florianbigard.com>2020-04-17 14:12:43 +0200
commit7e37e111116e41530749b88327bc601cb39ade03 (patch)
treea141a84b6999029084629d45a3d5addbfa34e603 /client/src/assets/player/peertube-player-manager.ts
parentbb3933ef370c46be6090e4e522c6e3f5b7144f4c (diff)
downloadPeerTube-7e37e111116e41530749b88327bc601cb39ade03.tar.gz
PeerTube-7e37e111116e41530749b88327bc601cb39ade03.tar.zst
PeerTube-7e37e111116e41530749b88327bc601cb39ade03.zip
Fix videojs typings
Diffstat (limited to 'client/src/assets/player/peertube-player-manager.ts')
-rw-r--r--client/src/assets/player/peertube-player-manager.ts18
1 files changed, 9 insertions, 9 deletions
diff --git a/client/src/assets/player/peertube-player-manager.ts b/client/src/assets/player/peertube-player-manager.ts
index 6d9236a9d..50701eefe 100644
--- a/client/src/assets/player/peertube-player-manager.ts
+++ b/client/src/assets/player/peertube-player-manager.ts
@@ -1,5 +1,5 @@
1import { VideoFile } from '../../../../shared/models/videos' 1import { VideoFile } from '../../../../shared/models/videos'
2import videojs, { VideoJsPlayer, VideoJsPlayerOptions } from 'video.js' 2import videojs from 'video.js/dist/alt/video.core.js'
3import 'videojs-hotkeys' 3import 'videojs-hotkeys'
4import 'videojs-dock' 4import 'videojs-dock'
5import 'videojs-contextmenu-ui' 5import 'videojs-contextmenu-ui'
@@ -99,9 +99,9 @@ export type PeertubePlayerManagerOptions = {
99 99
100export class PeertubePlayerManager { 100export class PeertubePlayerManager {
101 private static playerElementClassName: string 101 private static playerElementClassName: string
102 private static onPlayerChange: (player: VideoJsPlayer) => void 102 private static onPlayerChange: (player: videojs.Player) => void
103 103
104 static async initialize (mode: PlayerMode, options: PeertubePlayerManagerOptions, onPlayerChange: (player: VideoJsPlayer) => void) { 104 static async initialize (mode: PlayerMode, options: PeertubePlayerManagerOptions, onPlayerChange: (player: videojs.Player) => void) {
105 let p2pMediaLoader: any 105 let p2pMediaLoader: any
106 106
107 this.onPlayerChange = onPlayerChange 107 this.onPlayerChange = onPlayerChange
@@ -121,7 +121,7 @@ export class PeertubePlayerManager {
121 121
122 const self = this 122 const self = this
123 return new Promise(res => { 123 return new Promise(res => {
124 videojs(options.common.playerElement, videojsOptions, function (this: VideoJsPlayer) { 124 videojs(options.common.playerElement, videojsOptions, function (this: videojs.Player) {
125 const player = this 125 const player = this
126 126
127 let alreadyFallback = false 127 let alreadyFallback = false
@@ -171,7 +171,7 @@ export class PeertubePlayerManager {
171 const videojsOptions = this.getVideojsOptions(mode, options) 171 const videojsOptions = this.getVideojsOptions(mode, options)
172 172
173 const self = this 173 const self = this
174 videojs(newVideoElement, videojsOptions, function (this: VideoJsPlayer) { 174 videojs(newVideoElement, videojsOptions, function (this: videojs.Player) {
175 const player = this 175 const player = this
176 176
177 self.addContextMenu(mode, player, options.common.embedUrl) 177 self.addContextMenu(mode, player, options.common.embedUrl)
@@ -184,7 +184,7 @@ export class PeertubePlayerManager {
184 mode: PlayerMode, 184 mode: PlayerMode,
185 options: PeertubePlayerManagerOptions, 185 options: PeertubePlayerManagerOptions,
186 p2pMediaLoaderModule?: any 186 p2pMediaLoaderModule?: any
187 ): VideoJsPlayerOptions { 187 ): videojs.PlayerOptions {
188 const commonOptions = options.common 188 const commonOptions = options.common
189 189
190 let autoplay = commonOptions.autoplay 190 let autoplay = commonOptions.autoplay
@@ -417,7 +417,7 @@ export class PeertubePlayerManager {
417 return children 417 return children
418 } 418 }
419 419
420 private static addContextMenu (mode: PlayerMode, player: VideoJsPlayer, videoEmbedUrl: string) { 420 private static addContextMenu (mode: PlayerMode, player: videojs.Player, videoEmbedUrl: string) {
421 const content = [ 421 const content = [
422 { 422 {
423 label: player.localize('Copy the video URL'), 423 label: player.localize('Copy the video URL'),
@@ -427,7 +427,7 @@ export class PeertubePlayerManager {
427 }, 427 },
428 { 428 {
429 label: player.localize('Copy the video URL at the current time'), 429 label: player.localize('Copy the video URL at the current time'),
430 listener: function (this: VideoJsPlayer) { 430 listener: function (this: videojs.Player) {
431 copyToClipboard(buildVideoLink({ startTime: this.currentTime() })) 431 copyToClipboard(buildVideoLink({ startTime: this.currentTime() }))
432 } 432 }
433 }, 433 },
@@ -442,7 +442,7 @@ export class PeertubePlayerManager {
442 if (mode === 'webtorrent') { 442 if (mode === 'webtorrent') {
443 content.push({ 443 content.push({
444 label: player.localize('Copy magnet URI'), 444 label: player.localize('Copy magnet URI'),
445 listener: function (this: VideoJsPlayer) { 445 listener: function (this: videojs.Player) {
446 copyToClipboard(this.webtorrent().getCurrentVideoFile().magnetUri) 446 copyToClipboard(this.webtorrent().getCurrentVideoFile().magnetUri)
447 } 447 }
448 }) 448 })