]>
Commit | Line | Data |
---|---|---|
3e254de8 | 1 | import { HlsConfig, Level } from 'hls.js' |
5abc96fc | 2 | import videojs from 'video.js' |
9597920e | 3 | import { Engine } from '@peertube/p2p-media-loader-hlsjs' |
4572c3d0 | 4 | import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models' |
01dd04cd | 5 | import { PeerTubeDockPluginOptions } from './dock/peertube-dock-plugin' |
9597920e | 6 | import { PlayerMode } from './manager-options/manager-options.model' |
02b2e482 | 7 | import { Html5Hlsjs } from './p2p-media-loader/hls-plugin' |
09209296 | 8 | import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' |
da332417 | 9 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
5abc96fc | 10 | import { PeerTubePlugin } from './peertube-plugin' |
e367da94 | 11 | import { PeerTubeResolutionsPlugin } from './peertube-resolutions-plugin' |
4572c3d0 | 12 | import { PlaylistPlugin } from './playlist/playlist-plugin' |
ff563914 | 13 | import { StatsCardOptions } from './stats/stats-card' |
4e11d8f3 | 14 | import { StatsForNerdsPlugin } from './stats/stats-plugin' |
e367da94 C |
15 | import { EndCardOptions } from './upnext/end-card' |
16 | import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' | |
c6352f2c | 17 | |
f5fcd9f7 | 18 | declare module 'video.js' { |
83fcadac | 19 | |
f5fcd9f7 | 20 | export interface VideoJsPlayer { |
83fcadac C |
21 | srOptions_: HlsjsConfigHandlerOptions |
22 | ||
f5fcd9f7 C |
23 | theaterEnabled: boolean |
24 | ||
25 | // FIXME: add it to upstream typings | |
26 | posterImage: { | |
27 | show (): void | |
28 | hide (): void | |
29 | } | |
30 | ||
31 | handleTechSeeked_ (): void | |
32 | ||
33 | // Plugins | |
34 | ||
c6352f2c | 35 | peertube (): PeerTubePlugin |
83fcadac | 36 | |
2adfc7ea | 37 | webtorrent (): WebTorrentPlugin |
83fcadac | 38 | |
09209296 | 39 | p2pMediaLoader (): P2pMediaLoaderPlugin |
c6352f2c | 40 | |
e367da94 C |
41 | peertubeResolutions (): PeerTubeResolutionsPlugin |
42 | ||
f5fcd9f7 C |
43 | contextmenuUI (options: any): any |
44 | ||
45 | bezels (): void | |
f1a0555a | 46 | peertubeMobile (): void |
d7b052ff | 47 | peerTubeHotkeysPlugin (): void |
f1a0555a | 48 | |
4e11d8f3 | 49 | stats (options?: StatsCardOptions): StatsForNerdsPlugin |
ff563914 | 50 | |
f5fcd9f7 | 51 | textTracks (): TextTrackList & { |
1151f521 | 52 | tracks_: (TextTrack & { id: string, label: string, src: string })[] |
f5fcd9f7 | 53 | } |
83fcadac | 54 | |
01dd04cd | 55 | peertubeDock (options: PeerTubeDockPluginOptions): void |
5abc96fc C |
56 | |
57 | upnext (options: Partial<EndCardOptions>): void | |
4572c3d0 C |
58 | |
59 | playlist (): PlaylistPlugin | |
f5fcd9f7 | 60 | } |
c6352f2c C |
61 | } |
62 | ||
83fcadac | 63 | export interface VideoJSTechHLS extends videojs.Tech { |
02b2e482 | 64 | hlsProvider: Html5Hlsjs |
83fcadac C |
65 | } |
66 | ||
67 | export interface HlsjsConfigHandlerOptions { | |
02b2e482 | 68 | hlsjsConfig?: HlsConfig |
83fcadac C |
69 | |
70 | levelLabelHandler?: (level: Level) => string | |
71 | } | |
72 | ||
e367da94 | 73 | type PeerTubeResolution = { |
83fcadac | 74 | id: number |
83fcadac | 75 | |
e367da94 | 76 | height?: number |
83fcadac C |
77 | label?: string |
78 | width?: number | |
83fcadac C |
79 | bitrate?: number |
80 | ||
e367da94 C |
81 | selected: boolean |
82 | selectCallback: () => void | |
83fcadac C |
83 | } |
84 | ||
16f7022b C |
85 | type VideoJSCaption = { |
86 | label: string | |
87 | language: string | |
88 | src: string | |
89 | } | |
90 | ||
6e46de09 | 91 | type UserWatching = { |
9df52d66 | 92 | url: string |
6e46de09 C |
93 | authorizationHeader: string |
94 | } | |
95 | ||
2adfc7ea | 96 | type PeerTubePluginOptions = { |
09209296 C |
97 | mode: PlayerMode |
98 | ||
2adfc7ea | 99 | autoplay: boolean |
c6352f2c C |
100 | videoViewUrl: string |
101 | videoDuration: number | |
6e46de09 C |
102 | |
103 | userWatching?: UserWatching | |
2adfc7ea C |
104 | subtitle?: string |
105 | ||
106 | videoCaptions: VideoJSCaption[] | |
f0a39880 C |
107 | |
108 | stopTime: number | string | |
10f26f42 C |
109 | |
110 | isLive: boolean | |
58b9ce30 | 111 | |
112 | videoUUID: string | |
2adfc7ea C |
113 | } |
114 | ||
4572c3d0 | 115 | type PlaylistPluginOptions = { |
3e0e8d4a | 116 | elements: VideoPlaylistElement[] |
4572c3d0 C |
117 | |
118 | playlist: VideoPlaylist | |
119 | ||
120 | getCurrentPosition: () => number | |
121 | ||
3e0e8d4a | 122 | onItemClicked: (element: VideoPlaylistElement) => void |
4572c3d0 C |
123 | } |
124 | ||
a950e4c8 C |
125 | type NextPreviousVideoButtonOptions = { |
126 | type: 'next' | 'previous' | |
e367da94 | 127 | handler: () => void |
a950e4c8 C |
128 | isDisabled: () => boolean |
129 | } | |
130 | ||
9162fdd3 C |
131 | type PeerTubeLinkButtonOptions = { |
132 | shortUUID: string | |
133 | } | |
134 | ||
bf1c3c78 C |
135 | type PeerTubeP2PInfoButtonOptions = { |
136 | p2pEnabled: boolean | |
137 | } | |
138 | ||
2adfc7ea C |
139 | type WebtorrentPluginOptions = { |
140 | playerElement: HTMLVideoElement | |
141 | ||
142 | autoplay: boolean | |
143 | videoDuration: number | |
144 | ||
145 | videoFiles: VideoFile[] | |
f0a39880 C |
146 | |
147 | startTime: number | string | |
a9bfa85d C |
148 | |
149 | playerRefusedP2P: boolean | |
2adfc7ea C |
150 | } |
151 | ||
152 | type P2PMediaLoaderPluginOptions = { | |
da332417 | 153 | redundancyUrlManager: RedundancyUrlManager |
2adfc7ea C |
154 | type: string |
155 | src: string | |
f0a39880 C |
156 | |
157 | startTime: number | string | |
9597920e C |
158 | |
159 | loader: P2PMediaLoader | |
160 | } | |
161 | ||
162 | export type P2PMediaLoader = { | |
163 | getEngine(): Engine | |
2adfc7ea C |
164 | } |
165 | ||
166 | type VideoJSPluginOptions = { | |
4572c3d0 C |
167 | playlist?: PlaylistPluginOptions |
168 | ||
2adfc7ea C |
169 | peertube: PeerTubePluginOptions |
170 | ||
171 | webtorrent?: WebtorrentPluginOptions | |
172 | ||
173 | p2pMediaLoader?: P2PMediaLoaderPluginOptions | |
c6352f2c C |
174 | } |
175 | ||
2adfc7ea | 176 | type LoadedQualityData = { |
9df52d66 | 177 | qualitySwitchCallback: (resolutionId: number, type: 'video') => void |
2adfc7ea C |
178 | qualityData: { |
179 | video: { | |
180 | id: number | |
181 | label: string | |
182 | selected: boolean | |
183 | }[] | |
184 | } | |
185 | } | |
186 | ||
187 | type ResolutionUpdateData = { | |
9df52d66 | 188 | auto: boolean |
2adfc7ea | 189 | resolutionId: number |
3b6f205c | 190 | id?: number |
2adfc7ea C |
191 | } |
192 | ||
193 | type AutoResolutionUpdateData = { | |
194 | possible: boolean | |
195 | } | |
196 | ||
3b6f205c | 197 | type PlayerNetworkInfo = { |
17152837 FC |
198 | source: 'webtorrent' | 'p2p-media-loader' |
199 | ||
09209296 C |
200 | http: { |
201 | downloadSpeed: number | |
202 | uploadSpeed: number | |
203 | downloaded: number | |
204 | uploaded: number | |
205 | } | |
206 | ||
3b6f205c C |
207 | p2p: { |
208 | downloadSpeed: number | |
209 | uploadSpeed: number | |
210 | downloaded: number | |
211 | uploaded: number | |
212 | numPeers: number | |
213 | } | |
4e11d8f3 C |
214 | |
215 | // In bytes | |
216 | bandwidthEstimate: number | |
3b6f205c C |
217 | } |
218 | ||
4572c3d0 C |
219 | type PlaylistItemOptions = { |
220 | element: VideoPlaylistElement | |
221 | ||
e367da94 | 222 | onClicked: () => void |
4572c3d0 C |
223 | } |
224 | ||
c6352f2c | 225 | export { |
3b6f205c | 226 | PlayerNetworkInfo, |
4572c3d0 | 227 | PlaylistItemOptions, |
a950e4c8 | 228 | NextPreviousVideoButtonOptions, |
2adfc7ea C |
229 | ResolutionUpdateData, |
230 | AutoResolutionUpdateData, | |
4572c3d0 | 231 | PlaylistPluginOptions, |
6e46de09 | 232 | VideoJSCaption, |
2adfc7ea C |
233 | UserWatching, |
234 | PeerTubePluginOptions, | |
235 | WebtorrentPluginOptions, | |
236 | P2PMediaLoaderPluginOptions, | |
e367da94 | 237 | PeerTubeResolution, |
2adfc7ea | 238 | VideoJSPluginOptions, |
83fcadac | 239 | LoadedQualityData, |
bf1c3c78 C |
240 | PeerTubeLinkButtonOptions, |
241 | PeerTubeP2PInfoButtonOptions | |
c6352f2c | 242 | } |