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