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