diff options
author | Chocobozzz <me@florianbigard.com> | 2020-04-17 11:20:12 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-04-17 14:12:43 +0200 |
commit | 7e37e111116e41530749b88327bc601cb39ade03 (patch) | |
tree | a141a84b6999029084629d45a3d5addbfa34e603 | |
parent | bb3933ef370c46be6090e4e522c6e3f5b7144f4c (diff) | |
download | PeerTube-7e37e111116e41530749b88327bc601cb39ade03.tar.gz PeerTube-7e37e111116e41530749b88327bc601cb39ade03.tar.zst PeerTube-7e37e111116e41530749b88327bc601cb39ade03.zip |
Fix videojs typings
24 files changed, 60 insertions, 62 deletions
diff --git a/client/src/assets/player/bezels/bezels-plugin.ts b/client/src/assets/player/bezels/bezels-plugin.ts index 499177526..ad8bfa703 100644 --- a/client/src/assets/player/bezels/bezels-plugin.ts +++ b/client/src/assets/player/bezels/bezels-plugin.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | import './pause-bezel' | 2 | import './pause-bezel' |
3 | 3 | ||
4 | const Plugin = videojs.getPlugin('plugin') | 4 | const Plugin = videojs.getPlugin('plugin') |
5 | 5 | ||
6 | class BezelsPlugin extends Plugin { | 6 | class BezelsPlugin extends Plugin { |
7 | 7 | ||
8 | constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) { | 8 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { |
9 | super(player) | 9 | super(player) |
10 | 10 | ||
11 | this.player.ready(() => { | 11 | this.player.ready(() => { |
diff --git a/client/src/assets/player/bezels/pause-bezel.ts b/client/src/assets/player/bezels/pause-bezel.ts index 98eb12099..d9ef9a390 100644 --- a/client/src/assets/player/bezels/pause-bezel.ts +++ b/client/src/assets/player/bezels/pause-bezel.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | function getPauseBezel () { | 3 | function getPauseBezel () { |
4 | return ` | 4 | return ` |
@@ -34,7 +34,7 @@ const Component = videojs.getComponent('Component') | |||
34 | class PauseBezel extends Component { | 34 | class PauseBezel extends Component { |
35 | container: HTMLDivElement | 35 | container: HTMLDivElement |
36 | 36 | ||
37 | constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) { | 37 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { |
38 | super(player, options) | 38 | super(player, options) |
39 | 39 | ||
40 | player.on('pause', (_: any) => { | 40 | player.on('pause', (_: any) => { |
diff --git a/client/src/assets/player/p2p-media-loader/hls-plugin.ts b/client/src/assets/player/p2p-media-loader/hls-plugin.ts index 876ed7d9c..6937d147a 100644 --- a/client/src/assets/player/p2p-media-loader/hls-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/hls-plugin.ts | |||
@@ -2,7 +2,7 @@ | |||
2 | // We duplicated this plugin to choose the hls.js version we want, because streamroot only provide a bundled file | 2 | // We duplicated this plugin to choose the hls.js version we want, because streamroot only provide a bundled file |
3 | 3 | ||
4 | import * as Hlsjs from 'hls.js/dist/hls.light.js' | 4 | import * as Hlsjs from 'hls.js/dist/hls.light.js' |
5 | import videojs, { VideoJsPlayer } from 'video.js' | 5 | import videojs from 'video.js/dist/alt/video.core.js' |
6 | import { HlsjsConfigHandlerOptions, QualityLevelRepresentation, QualityLevels, VideoJSTechHLS } from '../peertube-videojs-typings' | 6 | import { HlsjsConfigHandlerOptions, QualityLevelRepresentation, QualityLevels, VideoJSTechHLS } from '../peertube-videojs-typings' |
7 | 7 | ||
8 | type ErrorCounts = { | 8 | type ErrorCounts = { |
@@ -55,7 +55,7 @@ const registerSourceHandler = function (vjs: typeof videojs) { | |||
55 | (vjs as any).Html5Hlsjs = Html5Hlsjs | 55 | (vjs as any).Html5Hlsjs = Html5Hlsjs |
56 | } | 56 | } |
57 | 57 | ||
58 | function hlsjsConfigHandler (this: VideoJsPlayer, options: HlsjsConfigHandlerOptions) { | 58 | function hlsjsConfigHandler (this: videojs.Player, options: HlsjsConfigHandlerOptions) { |
59 | const player = this | 59 | const player = this |
60 | 60 | ||
61 | if (!options) return | 61 | if (!options) return |
@@ -88,7 +88,7 @@ class Html5Hlsjs { | |||
88 | 88 | ||
89 | private readonly videoElement: HTMLVideoElement | 89 | private readonly videoElement: HTMLVideoElement |
90 | private readonly errorCounts: ErrorCounts = {} | 90 | private readonly errorCounts: ErrorCounts = {} |
91 | private readonly player: VideoJsPlayer | 91 | private readonly player: videojs.Player |
92 | private readonly tech: videojs.Tech | 92 | private readonly tech: videojs.Tech |
93 | private readonly source: videojs.Tech.SourceObject | 93 | private readonly source: videojs.Tech.SourceObject |
94 | private readonly vjs: typeof videojs | 94 | private readonly vjs: typeof videojs |
diff --git a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts index ca205d899..161c92b5e 100644 --- a/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts +++ b/client/src/assets/player/p2p-media-loader/p2p-media-loader-plugin.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../peertube-videojs-typings' | 2 | import { P2PMediaLoaderPluginOptions, PlayerNetworkInfo } from '../peertube-videojs-typings' |
3 | import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs' | 3 | import { Engine, initHlsJsPlayer, initVideoJsContribHlsJsPlayer } from 'p2p-media-loader-hlsjs' |
4 | import { Events, Segment } from 'p2p-media-loader-core' | 4 | import { Events, Segment } from 'p2p-media-loader-core' |
@@ -36,7 +36,7 @@ class P2pMediaLoaderPlugin extends Plugin { | |||
36 | 36 | ||
37 | private networkInfoInterval: any | 37 | private networkInfoInterval: any |
38 | 38 | ||
39 | constructor (player: VideoJsPlayer, options?: P2PMediaLoaderPluginOptions) { | 39 | constructor (player: videojs.Player, options?: P2PMediaLoaderPluginOptions) { |
40 | super(player) | 40 | super(player) |
41 | 41 | ||
42 | this.options = options | 42 | this.options = options |
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 @@ | |||
1 | import { VideoFile } from '../../../../shared/models/videos' | 1 | import { VideoFile } from '../../../../shared/models/videos' |
2 | import videojs, { VideoJsPlayer, VideoJsPlayerOptions } from 'video.js' | 2 | import videojs from 'video.js/dist/alt/video.core.js' |
3 | import 'videojs-hotkeys' | 3 | import 'videojs-hotkeys' |
4 | import 'videojs-dock' | 4 | import 'videojs-dock' |
5 | import 'videojs-contextmenu-ui' | 5 | import 'videojs-contextmenu-ui' |
@@ -99,9 +99,9 @@ export type PeertubePlayerManagerOptions = { | |||
99 | 99 | ||
100 | export class PeertubePlayerManager { | 100 | export 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 | }) |
diff --git a/client/src/assets/player/peertube-plugin.ts b/client/src/assets/player/peertube-plugin.ts index 19d104676..afd8d678b 100644 --- a/client/src/assets/player/peertube-plugin.ts +++ b/client/src/assets/player/peertube-plugin.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core' |
2 | import './videojs-components/settings-menu-button' | 2 | import './videojs-components/settings-menu-button' |
3 | import { | 3 | import { |
4 | PeerTubePluginOptions, | 4 | PeerTubePluginOptions, |
@@ -36,7 +36,7 @@ class PeerTubePlugin extends Plugin { | |||
36 | private mouseInControlBar = false | 36 | private mouseInControlBar = false |
37 | private readonly savedInactivityTimeout: number | 37 | private readonly savedInactivityTimeout: number |
38 | 38 | ||
39 | constructor (player: VideoJsPlayer, options?: PeerTubePluginOptions) { | 39 | constructor (player: videojs.Player, options?: PeerTubePluginOptions) { |
40 | super(player) | 40 | super(player) |
41 | 41 | ||
42 | this.videoViewUrl = options.videoViewUrl | 42 | this.videoViewUrl = options.videoViewUrl |
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts index a4e4c580c..9616dd326 100644 --- a/client/src/assets/player/peertube-videojs-typings.ts +++ b/client/src/assets/player/peertube-videojs-typings.ts | |||
@@ -4,7 +4,7 @@ import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin | |||
4 | import { PlayerMode } from './peertube-player-manager' | 4 | import { PlayerMode } from './peertube-player-manager' |
5 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' | 5 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
6 | import { VideoFile } from '@shared/models' | 6 | import { VideoFile } from '@shared/models' |
7 | import videojs from 'video.js' | 7 | import videojs from 'video.js/dist/alt/video.core.js' |
8 | import { Config, Level } from 'hls.js' | 8 | import { Config, Level } from 'hls.js' |
9 | 9 | ||
10 | declare module 'video.js' { | 10 | declare module 'video.js' { |
diff --git a/client/src/assets/player/upnext/end-card.ts b/client/src/assets/player/upnext/end-card.ts index d121a83a9..c39a9c913 100644 --- a/client/src/assets/player/upnext/end-card.ts +++ b/client/src/assets/player/upnext/end-card.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | function getMainTemplate (options: any) { | 3 | function getMainTemplate (options: any) { |
4 | return ` | 4 | return ` |
@@ -50,7 +50,7 @@ class EndCard extends Component { | |||
50 | suspendedMessage: HTMLElement | 50 | suspendedMessage: HTMLElement |
51 | nextButton: HTMLElement | 51 | nextButton: HTMLElement |
52 | 52 | ||
53 | constructor (player: VideoJsPlayer, options: EndCardOptions) { | 53 | constructor (player: videojs.Player, options: EndCardOptions) { |
54 | super(player, options) | 54 | super(player, options) |
55 | 55 | ||
56 | this.totalTicks = this.options_.timeout / this.interval | 56 | this.totalTicks = this.options_.timeout / this.interval |
diff --git a/client/src/assets/player/upnext/upnext-plugin.ts b/client/src/assets/player/upnext/upnext-plugin.ts index 6512fec2c..ac7699e9a 100644 --- a/client/src/assets/player/upnext/upnext-plugin.ts +++ b/client/src/assets/player/upnext/upnext-plugin.ts | |||
@@ -1,11 +1,11 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | import { EndCardOptions } from './end-card' | 2 | import { EndCardOptions } from './end-card' |
3 | 3 | ||
4 | const Plugin = videojs.getPlugin('plugin') | 4 | const Plugin = videojs.getPlugin('plugin') |
5 | 5 | ||
6 | class UpNextPlugin extends Plugin { | 6 | class UpNextPlugin extends Plugin { |
7 | 7 | ||
8 | constructor (player: VideoJsPlayer, options: Partial<EndCardOptions> = {}) { | 8 | constructor (player: videojs.Player, options: Partial<EndCardOptions> = {}) { |
9 | const settings = { | 9 | const settings = { |
10 | next: options.next, | 10 | next: options.next, |
11 | getTitle: options.getTitle, | 11 | getTitle: options.getTitle, |
diff --git a/client/src/assets/player/videojs-components/next-video-button.ts b/client/src/assets/player/videojs-components/next-video-button.ts index bdb245dcc..c97ecdda6 100644 --- a/client/src/assets/player/videojs-components/next-video-button.ts +++ b/client/src/assets/player/videojs-components/next-video-button.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | const Button = videojs.getComponent('Button') | 3 | const Button = videojs.getComponent('Button') |
4 | 4 | ||
@@ -9,7 +9,7 @@ export interface NextVideoButtonOptions extends videojs.ComponentOptions { | |||
9 | class NextVideoButton extends Button { | 9 | class NextVideoButton extends Button { |
10 | private readonly nextVideoButtonOptions: NextVideoButtonOptions | 10 | private readonly nextVideoButtonOptions: NextVideoButtonOptions |
11 | 11 | ||
12 | constructor (player: VideoJsPlayer, options?: NextVideoButtonOptions) { | 12 | constructor (player: videojs.Player, options?: NextVideoButtonOptions) { |
13 | super(player, options) | 13 | super(player, options) |
14 | 14 | ||
15 | this.nextVideoButtonOptions = options | 15 | this.nextVideoButtonOptions = options |
diff --git a/client/src/assets/player/videojs-components/p2p-info-button.ts b/client/src/assets/player/videojs-components/p2p-info-button.ts index db6806fed..e340337ed 100644 --- a/client/src/assets/player/videojs-components/p2p-info-button.ts +++ b/client/src/assets/player/videojs-components/p2p-info-button.ts | |||
@@ -1,5 +1,5 @@ | |||
1 | import { PlayerNetworkInfo } from '../peertube-videojs-typings' | 1 | import { PlayerNetworkInfo } from '../peertube-videojs-typings' |
2 | import videojs from 'video.js' | 2 | import videojs from 'video.js/dist/alt/video.core.js' |
3 | import { bytes } from '../utils' | 3 | import { bytes } from '../utils' |
4 | 4 | ||
5 | const Button = videojs.getComponent('Button') | 5 | const Button = videojs.getComponent('Button') |
diff --git a/client/src/assets/player/videojs-components/peertube-link-button.ts b/client/src/assets/player/videojs-components/peertube-link-button.ts index 0db9762a5..4151758d4 100644 --- a/client/src/assets/player/videojs-components/peertube-link-button.ts +++ b/client/src/assets/player/videojs-components/peertube-link-button.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import { buildVideoLink } from '../utils' | 1 | import { buildVideoLink } from '../utils' |
2 | import videojs, { VideoJsPlayer } from 'video.js' | 2 | import videojs from 'video.js/dist/alt/video.core.js' |
3 | 3 | ||
4 | const Button = videojs.getComponent('Button') | 4 | const Button = videojs.getComponent('Button') |
5 | class PeerTubeLinkButton extends Button { | 5 | class PeerTubeLinkButton extends Button { |
6 | 6 | ||
7 | constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) { | 7 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { |
8 | super(player, options) | 8 | super(player, options) |
9 | } | 9 | } |
10 | 10 | ||
diff --git a/client/src/assets/player/videojs-components/peertube-load-progress-bar.ts b/client/src/assets/player/videojs-components/peertube-load-progress-bar.ts index 8168e8f2d..395720c53 100644 --- a/client/src/assets/player/videojs-components/peertube-load-progress-bar.ts +++ b/client/src/assets/player/videojs-components/peertube-load-progress-bar.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | const Component = videojs.getComponent('Component') | 3 | const Component = videojs.getComponent('Component') |
4 | 4 | ||
5 | class PeerTubeLoadProgressBar extends Component { | 5 | class PeerTubeLoadProgressBar extends Component { |
6 | 6 | ||
7 | constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) { | 7 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { |
8 | super(player, options) | 8 | super(player, options) |
9 | 9 | ||
10 | this.on(player, 'progress', this.update) | 10 | this.on(player, 'progress', this.update) |
diff --git a/client/src/assets/player/videojs-components/resolution-menu-button.ts b/client/src/assets/player/videojs-components/resolution-menu-button.ts index 0fa6272e7..d49ca0230 100644 --- a/client/src/assets/player/videojs-components/resolution-menu-button.ts +++ b/client/src/assets/player/videojs-components/resolution-menu-button.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | import { LoadedQualityData } from '../peertube-videojs-typings' | 3 | import { LoadedQualityData } from '../peertube-videojs-typings' |
4 | import { ResolutionMenuItem } from './resolution-menu-item' | 4 | import { ResolutionMenuItem } from './resolution-menu-item' |
@@ -8,7 +8,7 @@ const MenuButton = videojs.getComponent('MenuButton') | |||
8 | class ResolutionMenuButton extends MenuButton { | 8 | class ResolutionMenuButton extends MenuButton { |
9 | labelEl_: HTMLElement | 9 | labelEl_: HTMLElement |
10 | 10 | ||
11 | constructor (player: VideoJsPlayer, options?: videojs.MenuButtonOptions) { | 11 | constructor (player: videojs.Player, options?: videojs.MenuButtonOptions) { |
12 | super(player, options) | 12 | super(player, options) |
13 | 13 | ||
14 | this.controlText('Quality') | 14 | this.controlText('Quality') |
diff --git a/client/src/assets/player/videojs-components/resolution-menu-item.ts b/client/src/assets/player/videojs-components/resolution-menu-item.ts index b039c4572..cb0d219ad 100644 --- a/client/src/assets/player/videojs-components/resolution-menu-item.ts +++ b/client/src/assets/player/videojs-components/resolution-menu-item.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | import { AutoResolutionUpdateData, ResolutionUpdateData } from '../peertube-videojs-typings' | 2 | import { AutoResolutionUpdateData, ResolutionUpdateData } from '../peertube-videojs-typings' |
3 | 3 | ||
4 | const MenuItem = videojs.getComponent('MenuItem') | 4 | const MenuItem = videojs.getComponent('MenuItem') |
@@ -19,7 +19,7 @@ class ResolutionMenuItem extends MenuItem { | |||
19 | private autoResolutionPossible: boolean | 19 | private autoResolutionPossible: boolean |
20 | private currentResolutionLabel: string | 20 | private currentResolutionLabel: string |
21 | 21 | ||
22 | constructor (player: VideoJsPlayer, options?: ResolutionMenuItemOptions) { | 22 | constructor (player: videojs.Player, options?: ResolutionMenuItemOptions) { |
23 | options.selectable = true | 23 | options.selectable = true |
24 | 24 | ||
25 | super(player, options) | 25 | super(player, options) |
diff --git a/client/src/assets/player/videojs-components/settings-dialog.ts b/client/src/assets/player/videojs-components/settings-dialog.ts index dd0b1e472..8fd5ad96c 100644 --- a/client/src/assets/player/videojs-components/settings-dialog.ts +++ b/client/src/assets/player/videojs-components/settings-dialog.ts | |||
@@ -1,9 +1,9 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | const Component = videojs.getComponent('Component') | 3 | const Component = videojs.getComponent('Component') |
4 | 4 | ||
5 | class SettingsDialog extends Component { | 5 | class SettingsDialog extends Component { |
6 | constructor (player: VideoJsPlayer) { | 6 | constructor (player: videojs.Player) { |
7 | super(player) | 7 | super(player) |
8 | 8 | ||
9 | this.hide() | 9 | this.hide() |
diff --git a/client/src/assets/player/videojs-components/settings-menu-button.ts b/client/src/assets/player/videojs-components/settings-menu-button.ts index eae628e7d..749128bdc 100644 --- a/client/src/assets/player/videojs-components/settings-menu-button.ts +++ b/client/src/assets/player/videojs-components/settings-menu-button.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu | 1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu |
2 | import { SettingsMenuItem } from './settings-menu-item' | 2 | import { SettingsMenuItem } from './settings-menu-item' |
3 | import { toTitleCase } from '../utils' | 3 | import { toTitleCase } from '../utils' |
4 | import videojs, { VideoJsPlayer } from 'video.js' | 4 | import videojs from 'video.js/dist/alt/video.core.js' |
5 | 5 | ||
6 | import { SettingsDialog } from './settings-dialog' | 6 | import { SettingsDialog } from './settings-dialog' |
7 | import { SettingsPanel } from './settings-panel' | 7 | import { SettingsPanel } from './settings-panel' |
@@ -32,7 +32,7 @@ class SettingsButton extends Button { | |||
32 | 32 | ||
33 | private settingsButtonOptions: SettingsButtonOptions | 33 | private settingsButtonOptions: SettingsButtonOptions |
34 | 34 | ||
35 | constructor (player: VideoJsPlayer, options?: SettingsButtonOptions) { | 35 | constructor (player: videojs.Player, options?: SettingsButtonOptions) { |
36 | super(player, options) | 36 | super(player, options) |
37 | 37 | ||
38 | this.settingsButtonOptions = options | 38 | this.settingsButtonOptions = options |
diff --git a/client/src/assets/player/videojs-components/settings-menu-item.ts b/client/src/assets/player/videojs-components/settings-menu-item.ts index f5671f49d..8d364591b 100644 --- a/client/src/assets/player/videojs-components/settings-menu-item.ts +++ b/client/src/assets/player/videojs-components/settings-menu-item.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu | 1 | // Thanks to Yanko Shterev: https://github.com/yshterev/videojs-settings-menu |
2 | import { toTitleCase } from '../utils' | 2 | import { toTitleCase } from '../utils' |
3 | import videojs, { VideoJsPlayer } from 'video.js' | 3 | import videojs from 'video.js/dist/alt/video.core.js' |
4 | import { SettingsButton } from './settings-menu-button' | 4 | import { SettingsButton } from './settings-menu-button' |
5 | import { SettingsDialog } from './settings-dialog' | 5 | import { SettingsDialog } from './settings-dialog' |
6 | import { SettingsPanel } from './settings-panel' | 6 | import { SettingsPanel } from './settings-panel' |
@@ -32,7 +32,7 @@ class SettingsMenuItem extends MenuItem { | |||
32 | settingsSubMenuValueEl_: HTMLElement | 32 | settingsSubMenuValueEl_: HTMLElement |
33 | settingsSubMenuEl_: HTMLElement | 33 | settingsSubMenuEl_: HTMLElement |
34 | 34 | ||
35 | constructor (player: VideoJsPlayer, options?: SettingsMenuItemOptions) { | 35 | constructor (player: videojs.Player, options?: SettingsMenuItemOptions) { |
36 | super(player, options) | 36 | super(player, options) |
37 | 37 | ||
38 | this.settingsButton = options.menuButton | 38 | this.settingsButton = options.menuButton |
diff --git a/client/src/assets/player/videojs-components/settings-panel-child.ts b/client/src/assets/player/videojs-components/settings-panel-child.ts index d12e8218a..6dee6d7df 100644 --- a/client/src/assets/player/videojs-components/settings-panel-child.ts +++ b/client/src/assets/player/videojs-components/settings-panel-child.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | const Component = videojs.getComponent('Component') | 3 | const Component = videojs.getComponent('Component') |
4 | 4 | ||
5 | class SettingsPanelChild extends Component { | 5 | class SettingsPanelChild extends Component { |
6 | 6 | ||
7 | constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) { | 7 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { |
8 | super(player, options) | 8 | super(player, options) |
9 | } | 9 | } |
10 | 10 | ||
diff --git a/client/src/assets/player/videojs-components/settings-panel.ts b/client/src/assets/player/videojs-components/settings-panel.ts index 2090abf45..833ee2f21 100644 --- a/client/src/assets/player/videojs-components/settings-panel.ts +++ b/client/src/assets/player/videojs-components/settings-panel.ts | |||
@@ -1,10 +1,10 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | 2 | ||
3 | const Component = videojs.getComponent('Component') | 3 | const Component = videojs.getComponent('Component') |
4 | 4 | ||
5 | class SettingsPanel extends Component { | 5 | class SettingsPanel extends Component { |
6 | 6 | ||
7 | constructor (player: VideoJsPlayer, options?: videojs.ComponentOptions) { | 7 | constructor (player: videojs.Player, options?: videojs.ComponentOptions) { |
8 | super(player, options) | 8 | super(player, options) |
9 | } | 9 | } |
10 | 10 | ||
diff --git a/client/src/assets/player/videojs-components/theater-button.ts b/client/src/assets/player/videojs-components/theater-button.ts index 1c8c9f154..41875af71 100644 --- a/client/src/assets/player/videojs-components/theater-button.ts +++ b/client/src/assets/player/videojs-components/theater-button.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | import { saveTheaterInStore, getStoredTheater } from '../peertube-player-local-storage' | 2 | import { saveTheaterInStore, getStoredTheater } from '../peertube-player-local-storage' |
3 | 3 | ||
4 | const Button = videojs.getComponent('Button') | 4 | const Button = videojs.getComponent('Button') |
@@ -6,7 +6,7 @@ class TheaterButton extends Button { | |||
6 | 6 | ||
7 | private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled' | 7 | private static readonly THEATER_MODE_CLASS = 'vjs-theater-enabled' |
8 | 8 | ||
9 | constructor (player: VideoJsPlayer, options: videojs.ComponentOptions) { | 9 | constructor (player: videojs.Player, options: videojs.ComponentOptions) { |
10 | super(player, options) | 10 | super(player, options) |
11 | 11 | ||
12 | const enabled = getStoredTheater() | 12 | const enabled = getStoredTheater() |
diff --git a/client/src/assets/player/webtorrent/webtorrent-plugin.ts b/client/src/assets/player/webtorrent/webtorrent-plugin.ts index bf6b0a718..26fb5a245 100644 --- a/client/src/assets/player/webtorrent/webtorrent-plugin.ts +++ b/client/src/assets/player/webtorrent/webtorrent-plugin.ts | |||
@@ -1,5 +1,4 @@ | |||
1 | import videojs, { VideoJsPlayer } from 'video.js' | 1 | import videojs from 'video.js/dist/alt/video.core.js' |
2 | |||
3 | import * as WebTorrent from 'webtorrent' | 2 | import * as WebTorrent from 'webtorrent' |
4 | import { renderVideo } from './video-renderer' | 3 | import { renderVideo } from './video-renderer' |
5 | import { LoadedQualityData, PlayerNetworkInfo, WebtorrentPluginOptions } from '../peertube-videojs-typings' | 4 | import { LoadedQualityData, PlayerNetworkInfo, WebtorrentPluginOptions } from '../peertube-videojs-typings' |
@@ -31,7 +30,7 @@ class WebTorrentPlugin extends Plugin { | |||
31 | 30 | ||
32 | private readonly autoplay: boolean = false | 31 | private readonly autoplay: boolean = false |
33 | private readonly startTime: number = 0 | 32 | private readonly startTime: number = 0 |
34 | private readonly savePlayerSrcFunction: VideoJsPlayer['src'] | 33 | private readonly savePlayerSrcFunction: videojs.Player['src'] |
35 | private readonly videoDuration: number | 34 | private readonly videoDuration: number |
36 | private readonly CONSTANTS = { | 35 | private readonly CONSTANTS = { |
37 | INFO_SCHEDULER: 1000, // Don't change this | 36 | INFO_SCHEDULER: 1000, // Don't change this |
@@ -69,7 +68,7 @@ class WebTorrentPlugin extends Plugin { | |||
69 | 68 | ||
70 | private downloadSpeeds: number[] = [] | 69 | private downloadSpeeds: number[] = [] |
71 | 70 | ||
72 | constructor (player: VideoJsPlayer, options?: WebtorrentPluginOptions) { | 71 | constructor (player: videojs.Player, options?: WebtorrentPluginOptions) { |
73 | super(player) | 72 | super(player) |
74 | 73 | ||
75 | this.startTime = timeToInt(options.startTime) | 74 | this.startTime = timeToInt(options.startTime) |
diff --git a/client/src/standalone/videos/embed.ts b/client/src/standalone/videos/embed.ts index 879850daf..6616fab48 100644 --- a/client/src/standalone/videos/embed.ts +++ b/client/src/standalone/videos/embed.ts | |||
@@ -15,14 +15,14 @@ import { | |||
15 | import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type' | 15 | import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type' |
16 | import { PeerTubeEmbedApi } from './embed-api' | 16 | import { PeerTubeEmbedApi } from './embed-api' |
17 | import { TranslationsManager } from '../../assets/player/translations-manager' | 17 | import { TranslationsManager } from '../../assets/player/translations-manager' |
18 | import { VideoJsPlayer } from 'video.js' | 18 | import videojs from 'video.js/dist/alt/video.core.js' |
19 | import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings' | 19 | import { VideoJSCaption } from '../../assets/player/peertube-videojs-typings' |
20 | 20 | ||
21 | type Translations = { [ id: string ]: string } | 21 | type Translations = { [ id: string ]: string } |
22 | 22 | ||
23 | export class PeerTubeEmbed { | 23 | export class PeerTubeEmbed { |
24 | videoElement: HTMLVideoElement | 24 | videoElement: HTMLVideoElement |
25 | player: VideoJsPlayer | 25 | player: videojs.Player |
26 | api: PeerTubeEmbedApi = null | 26 | api: PeerTubeEmbedApi = null |
27 | autoplay: boolean | 27 | autoplay: boolean |
28 | controls: boolean | 28 | controls: boolean |
@@ -237,7 +237,7 @@ export class PeerTubeEmbed { | |||
237 | }) | 237 | }) |
238 | } | 238 | } |
239 | 239 | ||
240 | this.player = await PeertubePlayerManager.initialize(this.mode, options, (player: VideoJsPlayer) => this.player = player) | 240 | this.player = await PeertubePlayerManager.initialize(this.mode, options, (player: videojs.Player) => this.player = player) |
241 | this.player.on('customError', (event: any, data: any) => this.handleError(data.err, serverTranslations)) | 241 | this.player.on('customError', (event: any, data: any) => this.handleError(data.err, serverTranslations)) |
242 | 242 | ||
243 | window[ 'videojsPlayer' ] = this.player | 243 | window[ 'videojsPlayer' ] = this.player |
diff --git a/client/tsconfig.json b/client/tsconfig.json index 3c671e579..d9e798f91 100644 --- a/client/tsconfig.json +++ b/client/tsconfig.json | |||
@@ -26,13 +26,12 @@ | |||
26 | "paths": { | 26 | "paths": { |
27 | "@app/*": [ "src/app/*" ], | 27 | "@app/*": [ "src/app/*" ], |
28 | "@shared/*": [ "../shared/*" ], | 28 | "@shared/*": [ "../shared/*" ], |
29 | "video.js": [ "node_modules/video.js/dist/alt/video.core" ], | 29 | "fs": [ "src/shims/noop.ts" ], |
30 | "fs": [ "src/shims/noop" ], | 30 | "http": [ "src/shims/http.ts" ], |
31 | "http": [ "src/shims/http" ], | 31 | "https": [ "src/shims/https.ts" ], |
32 | "https": [ "src/shims/https" ], | 32 | "path": [ "src/shims/path.ts" ], |
33 | "path": [ "src/shims/path" ], | 33 | "stream": [ "src/shims/noop.ts" ], |
34 | "stream": [ "src/shims/noop" ], | 34 | "crypto": [ "src/shims/noop.ts" ] |
35 | "crypto": [ "src/shims/noop" ] | ||
36 | } | 35 | } |
37 | }, | 36 | }, |
38 | "angularCompilerOptions": { | 37 | "angularCompilerOptions": { |