]>
Commit | Line | Data |
---|---|---|
5abc96fc C |
1 | import { Config, Level } from 'hls.js' |
2 | import videojs from 'video.js' | |
3 | import { VideoFile } from '@shared/models' | |
09209296 | 4 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' |
da332417 | 5 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
5abc96fc C |
6 | import { PlayerMode } from './peertube-player-manager' |
7 | import { PeerTubePlugin } from './peertube-plugin' | |
8 | import { EndCardOptions } from './upnext/end-card' | |
9 | import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' | |
c6352f2c | 10 | |
f5fcd9f7 | 11 | declare module 'video.js' { |
83fcadac | 12 | |
f5fcd9f7 | 13 | export interface VideoJsPlayer { |
83fcadac C |
14 | srOptions_: HlsjsConfigHandlerOptions |
15 | ||
f5fcd9f7 C |
16 | theaterEnabled: boolean |
17 | ||
18 | // FIXME: add it to upstream typings | |
19 | posterImage: { | |
20 | show (): void | |
21 | hide (): void | |
22 | } | |
23 | ||
24 | handleTechSeeked_ (): void | |
25 | ||
26 | // Plugins | |
27 | ||
c6352f2c | 28 | peertube (): PeerTubePlugin |
83fcadac | 29 | |
2adfc7ea | 30 | webtorrent (): WebTorrentPlugin |
83fcadac | 31 | |
09209296 | 32 | p2pMediaLoader (): P2pMediaLoaderPlugin |
c6352f2c | 33 | |
f5fcd9f7 C |
34 | contextmenuUI (options: any): any |
35 | ||
36 | bezels (): void | |
37 | ||
83fcadac | 38 | qualityLevels (): QualityLevels |
c6352f2c | 39 | |
f5fcd9f7 C |
40 | textTracks (): TextTrackList & { |
41 | on: Function | |
1151f521 | 42 | tracks_: (TextTrack & { id: string, label: string, src: string })[] |
f5fcd9f7 | 43 | } |
83fcadac | 44 | |
abb3097e | 45 | dock (options: { title: string, description: string }): void |
5abc96fc C |
46 | |
47 | upnext (options: Partial<EndCardOptions>): void | |
f5fcd9f7 | 48 | } |
c6352f2c C |
49 | } |
50 | ||
83fcadac C |
51 | export interface VideoJSTechHLS extends videojs.Tech { |
52 | hlsProvider: any // FIXME: typings | |
53 | } | |
54 | ||
55 | export interface HlsjsConfigHandlerOptions { | |
56 | hlsjsConfig?: Config & { cueHandler: any }// FIXME: typings | |
57 | captionConfig?: any // FIXME: typings | |
58 | ||
59 | levelLabelHandler?: (level: Level) => string | |
60 | } | |
61 | ||
62 | type QualityLevelRepresentation = { | |
63 | id: number | |
64 | height: number | |
65 | ||
66 | label?: string | |
67 | width?: number | |
68 | bandwidth?: number | |
69 | bitrate?: number | |
70 | ||
71 | enabled?: Function | |
72 | _enabled: boolean | |
73 | } | |
74 | ||
75 | type QualityLevels = QualityLevelRepresentation[] & { | |
76 | selectedIndex: number | |
77 | selectedIndex_: number | |
78 | ||
79 | addQualityLevel (representation: QualityLevelRepresentation): void | |
80 | } | |
81 | ||
16f7022b C |
82 | type VideoJSCaption = { |
83 | label: string | |
84 | language: string | |
85 | src: string | |
86 | } | |
87 | ||
6e46de09 C |
88 | type UserWatching = { |
89 | url: string, | |
90 | authorizationHeader: string | |
91 | } | |
92 | ||
2adfc7ea | 93 | type PeerTubePluginOptions = { |
09209296 C |
94 | mode: PlayerMode |
95 | ||
2adfc7ea | 96 | autoplay: boolean |
c6352f2c C |
97 | videoViewUrl: string |
98 | videoDuration: number | |
6e46de09 C |
99 | |
100 | userWatching?: UserWatching | |
2adfc7ea C |
101 | subtitle?: string |
102 | ||
103 | videoCaptions: VideoJSCaption[] | |
f0a39880 C |
104 | |
105 | stopTime: number | string | |
2adfc7ea C |
106 | } |
107 | ||
108 | type WebtorrentPluginOptions = { | |
109 | playerElement: HTMLVideoElement | |
110 | ||
111 | autoplay: boolean | |
112 | videoDuration: number | |
113 | ||
114 | videoFiles: VideoFile[] | |
f0a39880 C |
115 | |
116 | startTime: number | string | |
2adfc7ea C |
117 | } |
118 | ||
119 | type P2PMediaLoaderPluginOptions = { | |
da332417 | 120 | redundancyUrlManager: RedundancyUrlManager |
2adfc7ea C |
121 | type: string |
122 | src: string | |
f0a39880 C |
123 | |
124 | startTime: number | string | |
2adfc7ea C |
125 | } |
126 | ||
127 | type VideoJSPluginOptions = { | |
128 | peertube: PeerTubePluginOptions | |
129 | ||
130 | webtorrent?: WebtorrentPluginOptions | |
131 | ||
132 | p2pMediaLoader?: P2PMediaLoaderPluginOptions | |
c6352f2c C |
133 | } |
134 | ||
2adfc7ea C |
135 | type LoadedQualityData = { |
136 | qualitySwitchCallback: Function, | |
137 | qualityData: { | |
138 | video: { | |
139 | id: number | |
140 | label: string | |
141 | selected: boolean | |
142 | }[] | |
143 | } | |
144 | } | |
145 | ||
146 | type ResolutionUpdateData = { | |
147 | auto: boolean, | |
148 | resolutionId: number | |
3b6f205c | 149 | id?: number |
2adfc7ea C |
150 | } |
151 | ||
152 | type AutoResolutionUpdateData = { | |
153 | possible: boolean | |
154 | } | |
155 | ||
3b6f205c | 156 | type PlayerNetworkInfo = { |
09209296 C |
157 | http: { |
158 | downloadSpeed: number | |
159 | uploadSpeed: number | |
160 | downloaded: number | |
161 | uploaded: number | |
162 | } | |
163 | ||
3b6f205c C |
164 | p2p: { |
165 | downloadSpeed: number | |
166 | uploadSpeed: number | |
167 | downloaded: number | |
168 | uploaded: number | |
169 | numPeers: number | |
170 | } | |
171 | } | |
172 | ||
c6352f2c | 173 | export { |
3b6f205c | 174 | PlayerNetworkInfo, |
2adfc7ea C |
175 | ResolutionUpdateData, |
176 | AutoResolutionUpdateData, | |
6e46de09 | 177 | VideoJSCaption, |
2adfc7ea C |
178 | UserWatching, |
179 | PeerTubePluginOptions, | |
180 | WebtorrentPluginOptions, | |
181 | P2PMediaLoaderPluginOptions, | |
182 | VideoJSPluginOptions, | |
83fcadac C |
183 | LoadedQualityData, |
184 | QualityLevelRepresentation, | |
185 | QualityLevels | |
c6352f2c | 186 | } |