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