aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-typings.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/peertube-videojs-typings.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-typings.ts51
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 1import videojs from 'video.js'
2// @ts-ignore
3import * as videojs from 'video.js'
4
5import { PeerTubePlugin } from './peertube-plugin' 2import { PeerTubePlugin } from './peertube-plugin'
6import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' 3import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
7import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' 4import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
@@ -9,20 +6,45 @@ import { PlayerMode } from './peertube-player-manager'
9import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' 6import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
10import { VideoFile } from '@shared/models' 7import { VideoFile } from '@shared/models'
11 8
12declare namespace videojs { 9declare 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
20interface 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
28type VideoJSCaption = { 50type 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
82const videojsUntyped = videojs as any
83
84type LoadedQualityData = { 103type 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,