]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - client/src/assets/player/peertube-videojs-typings.ts
Merge branch 'release/2.1.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-videojs-typings.ts
1 import videojs from 'video.js'
2 import { PeerTubePlugin } from './peertube-plugin'
3 import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
4 import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
5 import { PlayerMode } from './peertube-player-manager'
6 import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
7 import { VideoFile } from '@shared/models'
8
9 declare module 'video.js' {
10 export interface VideoJsPlayer {
11 theaterEnabled: boolean
12
13 // FIXME: add it to upstream typings
14 posterImage: {
15 show (): void
16 hide (): void
17 }
18
19 handleTechSeeked_ (): void
20
21 // Plugins
22
23 peertube (): PeerTubePlugin
24 webtorrent (): WebTorrentPlugin
25 p2pMediaLoader (): P2pMediaLoaderPlugin
26
27 contextmenuUI (options: any): any
28
29 bezels (): void
30
31 qualityLevels (): { height: number, id: number }[] & {
32 selectedIndex: number
33 selectedIndex_: number
34
35 addQualityLevel (representation: {
36 id: number
37 label: string
38 height: number
39 _enabled: boolean
40 }): void
41 }
42
43 textTracks (): TextTrackList & {
44 on: Function
45 tracks_: { kind: string, mode: string, language: string }[]
46 }
47 }
48 }
49
50 type VideoJSCaption = {
51 label: string
52 language: string
53 src: string
54 }
55
56 type UserWatching = {
57 url: string,
58 authorizationHeader: string
59 }
60
61 type PeerTubePluginOptions = {
62 mode: PlayerMode
63
64 autoplay: boolean
65 videoViewUrl: string
66 videoDuration: number
67
68 userWatching?: UserWatching
69 subtitle?: string
70
71 videoCaptions: VideoJSCaption[]
72
73 stopTime: number | string
74 }
75
76 type WebtorrentPluginOptions = {
77 playerElement: HTMLVideoElement
78
79 autoplay: boolean
80 videoDuration: number
81
82 videoFiles: VideoFile[]
83
84 startTime: number | string
85 }
86
87 type P2PMediaLoaderPluginOptions = {
88 redundancyUrlManager: RedundancyUrlManager
89 type: string
90 src: string
91
92 startTime: number | string
93 }
94
95 type VideoJSPluginOptions = {
96 peertube: PeerTubePluginOptions
97
98 webtorrent?: WebtorrentPluginOptions
99
100 p2pMediaLoader?: P2PMediaLoaderPluginOptions
101 }
102
103 type LoadedQualityData = {
104 qualitySwitchCallback: Function,
105 qualityData: {
106 video: {
107 id: number
108 label: string
109 selected: boolean
110 }[]
111 }
112 }
113
114 type ResolutionUpdateData = {
115 auto: boolean,
116 resolutionId: number
117 id?: number
118 }
119
120 type AutoResolutionUpdateData = {
121 possible: boolean
122 }
123
124 type PlayerNetworkInfo = {
125 http: {
126 downloadSpeed: number
127 uploadSpeed: number
128 downloaded: number
129 uploaded: number
130 }
131
132 p2p: {
133 downloadSpeed: number
134 uploadSpeed: number
135 downloaded: number
136 uploaded: number
137 numPeers: number
138 }
139 }
140
141 export {
142 PlayerNetworkInfo,
143 ResolutionUpdateData,
144 AutoResolutionUpdateData,
145 VideoJSCaption,
146 UserWatching,
147 PeerTubePluginOptions,
148 WebtorrentPluginOptions,
149 P2PMediaLoaderPluginOptions,
150 VideoJSPluginOptions,
151 LoadedQualityData
152 }