diff options
Diffstat (limited to 'client/src/assets/player/peertube-videojs-typings.ts')
-rw-r--r-- | client/src/assets/player/peertube-videojs-typings.ts | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts index aad4dbb4f..e45722661 100644 --- a/client/src/assets/player/peertube-videojs-typings.ts +++ b/client/src/assets/player/peertube-videojs-typings.ts | |||
@@ -1,7 +1,4 @@ | |||
1 | // FIXME: something weird with our path definition in tsconfig and typings | 1 | import videojs from 'video.js' |
2 | // @ts-ignore | ||
3 | import * as videojs from 'video.js' | ||
4 | |||
5 | import { PeerTubePlugin } from './peertube-plugin' | 2 | import { PeerTubePlugin } from './peertube-plugin' |
6 | import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' | 3 | import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' |
7 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' | 4 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' |
@@ -9,20 +6,45 @@ import { PlayerMode } from './peertube-player-manager' | |||
9 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' | 6 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
10 | import { VideoFile } from '@shared/models' | 7 | import { VideoFile } from '@shared/models' |
11 | 8 | ||
12 | declare namespace videojs { | 9 | declare module 'video.js' { |
13 | interface Player { | 10 | export interface VideoJsPlayer { |
11 | theaterEnabled: boolean | ||
12 | |||
13 | // FIXME: add it to upstream typings | ||
14 | posterImage: { | ||
15 | show (): void | ||
16 | hide (): void | ||
17 | } | ||
18 | |||
19 | handleTechSeeked_ (): void | ||
20 | |||
21 | // Plugins | ||
22 | |||
14 | peertube (): PeerTubePlugin | 23 | peertube (): PeerTubePlugin |
15 | webtorrent (): WebTorrentPlugin | 24 | webtorrent (): WebTorrentPlugin |
16 | p2pMediaLoader (): P2pMediaLoaderPlugin | 25 | p2pMediaLoader (): P2pMediaLoaderPlugin |
17 | } | ||
18 | } | ||
19 | 26 | ||
20 | interface VideoJSComponentInterface { | 27 | contextmenuUI (options: any): any |
21 | _player: videojs.Player | 28 | |
29 | bezels (): void | ||
30 | |||
31 | qualityLevels (): { height: number, id: number }[] & { | ||
32 | selectedIndex: number | ||
33 | selectedIndex_: number | ||
22 | 34 | ||
23 | new (player: videojs.Player, options?: any): any | 35 | addQualityLevel (representation: { |
36 | id: number | ||
37 | label: string | ||
38 | height: number | ||
39 | _enabled: boolean | ||
40 | }): void | ||
41 | } | ||
24 | 42 | ||
25 | registerComponent (name: string, obj: any): any | 43 | textTracks (): TextTrackList & { |
44 | on: Function | ||
45 | tracks_: { kind: string, mode: string, language: string }[] | ||
46 | } | ||
47 | } | ||
26 | } | 48 | } |
27 | 49 | ||
28 | type VideoJSCaption = { | 50 | type VideoJSCaption = { |
@@ -78,9 +100,6 @@ type VideoJSPluginOptions = { | |||
78 | p2pMediaLoader?: P2PMediaLoaderPluginOptions | 100 | p2pMediaLoader?: P2PMediaLoaderPluginOptions |
79 | } | 101 | } |
80 | 102 | ||
81 | // videojs typings don't have some method we need | ||
82 | const videojsUntyped = videojs as any | ||
83 | |||
84 | type LoadedQualityData = { | 103 | type LoadedQualityData = { |
85 | qualitySwitchCallback: Function, | 104 | qualitySwitchCallback: Function, |
86 | qualityData: { | 105 | qualityData: { |
@@ -123,8 +142,6 @@ export { | |||
123 | PlayerNetworkInfo, | 142 | PlayerNetworkInfo, |
124 | ResolutionUpdateData, | 143 | ResolutionUpdateData, |
125 | AutoResolutionUpdateData, | 144 | AutoResolutionUpdateData, |
126 | VideoJSComponentInterface, | ||
127 | videojsUntyped, | ||
128 | VideoJSCaption, | 145 | VideoJSCaption, |
129 | UserWatching, | 146 | UserWatching, |
130 | PeerTubePluginOptions, | 147 | PeerTubePluginOptions, |