]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/assets/player/peertube-videojs-typings.ts
Cleanup tokens logic in embed
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-videojs-typings.ts
CommitLineData
2adfc7ea 1import { PeerTubePlugin } from './peertube-plugin'
09209296
C
2import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
3import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
4import { PlayerMode } from './peertube-player-manager'
da332417 5import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
d7a25329 6import { VideoFile } from '@shared/models'
512decf3 7import videojs from 'video.js'
83fcadac 8import { Config, Level } from 'hls.js'
c6352f2c 9
f5fcd9f7 10declare 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 43
abb3097e 44 dock (options: { title: string, description: string }): void
f5fcd9f7 45 }
c6352f2c
C
46}
47
83fcadac
C
48export interface VideoJSTechHLS extends videojs.Tech {
49 hlsProvider: any // FIXME: typings
50}
51
52export interface HlsjsConfigHandlerOptions {
53 hlsjsConfig?: Config & { cueHandler: any }// FIXME: typings
54 captionConfig?: any // FIXME: typings
55
56 levelLabelHandler?: (level: Level) => string
57}
58
59type QualityLevelRepresentation = {
60 id: number
61 height: number
62
63 label?: string
64 width?: number
65 bandwidth?: number
66 bitrate?: number
67
68 enabled?: Function
69 _enabled: boolean
70}
71
72type QualityLevels = QualityLevelRepresentation[] & {
73 selectedIndex: number
74 selectedIndex_: number
75
76 addQualityLevel (representation: QualityLevelRepresentation): void
77}
78
16f7022b
C
79type VideoJSCaption = {
80 label: string
81 language: string
82 src: string
83}
84
6e46de09
C
85type UserWatching = {
86 url: string,
87 authorizationHeader: string
88}
89
2adfc7ea 90type PeerTubePluginOptions = {
09209296
C
91 mode: PlayerMode
92
2adfc7ea 93 autoplay: boolean
c6352f2c
C
94 videoViewUrl: string
95 videoDuration: number
6e46de09
C
96
97 userWatching?: UserWatching
2adfc7ea
C
98 subtitle?: string
99
100 videoCaptions: VideoJSCaption[]
f0a39880
C
101
102 stopTime: number | string
2adfc7ea
C
103}
104
105type WebtorrentPluginOptions = {
106 playerElement: HTMLVideoElement
107
108 autoplay: boolean
109 videoDuration: number
110
111 videoFiles: VideoFile[]
f0a39880
C
112
113 startTime: number | string
2adfc7ea
C
114}
115
116type P2PMediaLoaderPluginOptions = {
da332417 117 redundancyUrlManager: RedundancyUrlManager
2adfc7ea
C
118 type: string
119 src: string
f0a39880
C
120
121 startTime: number | string
2adfc7ea
C
122}
123
124type VideoJSPluginOptions = {
125 peertube: PeerTubePluginOptions
126
127 webtorrent?: WebtorrentPluginOptions
128
129 p2pMediaLoader?: P2PMediaLoaderPluginOptions
c6352f2c
C
130}
131
2adfc7ea
C
132type LoadedQualityData = {
133 qualitySwitchCallback: Function,
134 qualityData: {
135 video: {
136 id: number
137 label: string
138 selected: boolean
139 }[]
140 }
141}
142
143type ResolutionUpdateData = {
144 auto: boolean,
145 resolutionId: number
3b6f205c 146 id?: number
2adfc7ea
C
147}
148
149type AutoResolutionUpdateData = {
150 possible: boolean
151}
152
3b6f205c 153type PlayerNetworkInfo = {
09209296
C
154 http: {
155 downloadSpeed: number
156 uploadSpeed: number
157 downloaded: number
158 uploaded: number
159 }
160
3b6f205c
C
161 p2p: {
162 downloadSpeed: number
163 uploadSpeed: number
164 downloaded: number
165 uploaded: number
166 numPeers: number
167 }
168}
169
c6352f2c 170export {
3b6f205c 171 PlayerNetworkInfo,
2adfc7ea
C
172 ResolutionUpdateData,
173 AutoResolutionUpdateData,
6e46de09 174 VideoJSCaption,
2adfc7ea
C
175 UserWatching,
176 PeerTubePluginOptions,
177 WebtorrentPluginOptions,
178 P2PMediaLoaderPluginOptions,
179 VideoJSPluginOptions,
83fcadac
C
180 LoadedQualityData,
181 QualityLevelRepresentation,
182 QualityLevels
c6352f2c 183}