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