]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame_incremental - client/src/assets/player/peertube-videojs-typings.ts
Upgrade to angular 10
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-videojs-typings.ts
... / ...
CommitLineData
1import { PeerTubePlugin } from './peertube-plugin'
2import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
3import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
4import { PlayerMode } from './peertube-player-manager'
5import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
6import { VideoFile } from '@shared/models'
7import videojs from 'video.js'
8import { Config, Level } from 'hls.js'
9
10declare module 'video.js' {
11
12 export interface VideoJsPlayer {
13 srOptions_: HlsjsConfigHandlerOptions
14
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
27 peertube (): PeerTubePlugin
28
29 webtorrent (): WebTorrentPlugin
30
31 p2pMediaLoader (): P2pMediaLoaderPlugin
32
33 contextmenuUI (options: any): any
34
35 bezels (): void
36
37 qualityLevels (): QualityLevels
38
39 textTracks (): TextTrackList & {
40 on: Function
41 tracks_: (TextTrack & { id: string, label: string, src: string })[]
42 }
43
44 dock (options: { title: string, description: string }): void
45 }
46}
47
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
79type VideoJSCaption = {
80 label: string
81 language: string
82 src: string
83}
84
85type UserWatching = {
86 url: string,
87 authorizationHeader: string
88}
89
90type PeerTubePluginOptions = {
91 mode: PlayerMode
92
93 autoplay: boolean
94 videoViewUrl: string
95 videoDuration: number
96
97 userWatching?: UserWatching
98 subtitle?: string
99
100 videoCaptions: VideoJSCaption[]
101
102 stopTime: number | string
103}
104
105type WebtorrentPluginOptions = {
106 playerElement: HTMLVideoElement
107
108 autoplay: boolean
109 videoDuration: number
110
111 videoFiles: VideoFile[]
112
113 startTime: number | string
114}
115
116type P2PMediaLoaderPluginOptions = {
117 redundancyUrlManager: RedundancyUrlManager
118 type: string
119 src: string
120
121 startTime: number | string
122}
123
124type VideoJSPluginOptions = {
125 peertube: PeerTubePluginOptions
126
127 webtorrent?: WebtorrentPluginOptions
128
129 p2pMediaLoader?: P2PMediaLoaderPluginOptions
130}
131
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
146 id?: number
147}
148
149type AutoResolutionUpdateData = {
150 possible: boolean
151}
152
153type PlayerNetworkInfo = {
154 http: {
155 downloadSpeed: number
156 uploadSpeed: number
157 downloaded: number
158 uploaded: number
159 }
160
161 p2p: {
162 downloadSpeed: number
163 uploadSpeed: number
164 downloaded: number
165 uploaded: number
166 numPeers: number
167 }
168}
169
170export {
171 PlayerNetworkInfo,
172 ResolutionUpdateData,
173 AutoResolutionUpdateData,
174 VideoJSCaption,
175 UserWatching,
176 PeerTubePluginOptions,
177 WebtorrentPluginOptions,
178 P2PMediaLoaderPluginOptions,
179 VideoJSPluginOptions,
180 LoadedQualityData,
181 QualityLevelRepresentation,
182 QualityLevels
183}