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