]>
Commit | Line | Data |
---|---|---|
f5fcd9f7 | 1 | import videojs from 'video.js' |
2adfc7ea | 2 | import { PeerTubePlugin } from './peertube-plugin' |
09209296 C |
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' | |
da332417 | 6 | import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager' |
d7a25329 | 7 | import { VideoFile } from '@shared/models' |
c6352f2c | 8 | |
f5fcd9f7 C |
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 | ||
c6352f2c | 23 | peertube (): PeerTubePlugin |
2adfc7ea | 24 | webtorrent (): WebTorrentPlugin |
09209296 | 25 | p2pMediaLoader (): P2pMediaLoaderPlugin |
c6352f2c | 26 | |
f5fcd9f7 C |
27 | contextmenuUI (options: any): any |
28 | ||
29 | bezels (): void | |
30 | ||
31 | qualityLevels (): { height: number, id: number }[] & { | |
32 | selectedIndex: number | |
cf57794e | 33 | selectedIndex_: number |
c6352f2c | 34 | |
f5fcd9f7 C |
35 | addQualityLevel (representation: { |
36 | id: number | |
37 | label: string | |
cf57794e | 38 | height: number |
f5fcd9f7 C |
39 | _enabled: boolean |
40 | }): void | |
41 | } | |
c6352f2c | 42 | |
f5fcd9f7 C |
43 | textTracks (): TextTrackList & { |
44 | on: Function | |
45 | tracks_: { kind: string, mode: string, language: string }[] | |
46 | } | |
47 | } | |
c6352f2c C |
48 | } |
49 | ||
16f7022b C |
50 | type VideoJSCaption = { |
51 | label: string | |
52 | language: string | |
53 | src: string | |
54 | } | |
55 | ||
6e46de09 C |
56 | type UserWatching = { |
57 | url: string, | |
58 | authorizationHeader: string | |
59 | } | |
60 | ||
2adfc7ea | 61 | type PeerTubePluginOptions = { |
09209296 C |
62 | mode: PlayerMode |
63 | ||
2adfc7ea | 64 | autoplay: boolean |
c6352f2c C |
65 | videoViewUrl: string |
66 | videoDuration: number | |
6e46de09 C |
67 | |
68 | userWatching?: UserWatching | |
2adfc7ea C |
69 | subtitle?: string |
70 | ||
71 | videoCaptions: VideoJSCaption[] | |
f0a39880 C |
72 | |
73 | stopTime: number | string | |
2adfc7ea C |
74 | } |
75 | ||
76 | type WebtorrentPluginOptions = { | |
77 | playerElement: HTMLVideoElement | |
78 | ||
79 | autoplay: boolean | |
80 | videoDuration: number | |
81 | ||
82 | videoFiles: VideoFile[] | |
f0a39880 C |
83 | |
84 | startTime: number | string | |
2adfc7ea C |
85 | } |
86 | ||
87 | type P2PMediaLoaderPluginOptions = { | |
da332417 | 88 | redundancyUrlManager: RedundancyUrlManager |
2adfc7ea C |
89 | type: string |
90 | src: string | |
f0a39880 C |
91 | |
92 | startTime: number | string | |
2adfc7ea C |
93 | } |
94 | ||
95 | type VideoJSPluginOptions = { | |
96 | peertube: PeerTubePluginOptions | |
97 | ||
98 | webtorrent?: WebtorrentPluginOptions | |
99 | ||
100 | p2pMediaLoader?: P2PMediaLoaderPluginOptions | |
c6352f2c C |
101 | } |
102 | ||
2adfc7ea C |
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 | |
3b6f205c | 117 | id?: number |
2adfc7ea C |
118 | } |
119 | ||
120 | type AutoResolutionUpdateData = { | |
121 | possible: boolean | |
122 | } | |
123 | ||
3b6f205c | 124 | type PlayerNetworkInfo = { |
09209296 C |
125 | http: { |
126 | downloadSpeed: number | |
127 | uploadSpeed: number | |
128 | downloaded: number | |
129 | uploaded: number | |
130 | } | |
131 | ||
3b6f205c C |
132 | p2p: { |
133 | downloadSpeed: number | |
134 | uploadSpeed: number | |
135 | downloaded: number | |
136 | uploaded: number | |
137 | numPeers: number | |
138 | } | |
139 | } | |
140 | ||
c6352f2c | 141 | export { |
3b6f205c | 142 | PlayerNetworkInfo, |
2adfc7ea C |
143 | ResolutionUpdateData, |
144 | AutoResolutionUpdateData, | |
6e46de09 | 145 | VideoJSCaption, |
2adfc7ea C |
146 | UserWatching, |
147 | PeerTubePluginOptions, | |
148 | WebtorrentPluginOptions, | |
149 | P2PMediaLoaderPluginOptions, | |
150 | VideoJSPluginOptions, | |
151 | LoadedQualityData | |
c6352f2c | 152 | } |