]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/assets/player/peertube-videojs-typings.ts
Update client dep
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-videojs-typings.ts
CommitLineData
c199c427
C
1// FIXME: something weird with our path definition in tsconfig and typings
2// @ts-ignore
3import * as videojs from 'video.js'
4
c6352f2c 5import { VideoFile } from '../../../../shared/models/videos/video.model'
2adfc7ea 6import { PeerTubePlugin } from './peertube-plugin'
09209296
C
7import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
8import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
9import { PlayerMode } from './peertube-player-manager'
c6352f2c 10
6cca7360 11declare namespace videojs {
c6352f2c
C
12 interface Player {
13 peertube (): PeerTubePlugin
2adfc7ea 14 webtorrent (): WebTorrentPlugin
09209296 15 p2pMediaLoader (): P2pMediaLoaderPlugin
c6352f2c
C
16 }
17}
18
19interface VideoJSComponentInterface {
20 _player: videojs.Player
21
244b4ae3 22 new (player: videojs.Player, options?: any): any
c6352f2c 23
244b4ae3 24 registerComponent (name: string, obj: any): any
c6352f2c
C
25}
26
16f7022b
C
27type VideoJSCaption = {
28 label: string
29 language: string
30 src: string
31}
32
6e46de09
C
33type UserWatching = {
34 url: string,
35 authorizationHeader: string
36}
37
2adfc7ea 38type PeerTubePluginOptions = {
09209296
C
39 mode: PlayerMode
40
2adfc7ea 41 autoplay: boolean
c6352f2c
C
42 videoViewUrl: string
43 videoDuration: number
6e46de09
C
44
45 userWatching?: UserWatching
2adfc7ea
C
46 subtitle?: string
47
48 videoCaptions: VideoJSCaption[]
f0a39880
C
49
50 stopTime: number | string
2adfc7ea
C
51}
52
53type WebtorrentPluginOptions = {
54 playerElement: HTMLVideoElement
55
56 autoplay: boolean
57 videoDuration: number
58
59 videoFiles: VideoFile[]
f0a39880
C
60
61 startTime: number | string
2adfc7ea
C
62}
63
64type P2PMediaLoaderPluginOptions = {
09209296 65 redundancyBaseUrls: string[]
2adfc7ea
C
66 type: string
67 src: string
f0a39880
C
68
69 startTime: number | string
2adfc7ea
C
70}
71
72type VideoJSPluginOptions = {
73 peertube: PeerTubePluginOptions
74
75 webtorrent?: WebtorrentPluginOptions
76
77 p2pMediaLoader?: P2PMediaLoaderPluginOptions
c6352f2c
C
78}
79
80// videojs typings don't have some method we need
81const videojsUntyped = videojs as any
82
2adfc7ea
C
83type LoadedQualityData = {
84 qualitySwitchCallback: Function,
85 qualityData: {
86 video: {
87 id: number
88 label: string
89 selected: boolean
90 }[]
91 }
92}
93
94type ResolutionUpdateData = {
95 auto: boolean,
96 resolutionId: number
3b6f205c 97 id?: number
2adfc7ea
C
98}
99
100type AutoResolutionUpdateData = {
101 possible: boolean
102}
103
3b6f205c 104type PlayerNetworkInfo = {
09209296
C
105 http: {
106 downloadSpeed: number
107 uploadSpeed: number
108 downloaded: number
109 uploaded: number
110 }
111
3b6f205c
C
112 p2p: {
113 downloadSpeed: number
114 uploadSpeed: number
115 downloaded: number
116 uploaded: number
117 numPeers: number
118 }
119}
120
c6352f2c 121export {
3b6f205c 122 PlayerNetworkInfo,
2adfc7ea
C
123 ResolutionUpdateData,
124 AutoResolutionUpdateData,
c6352f2c 125 VideoJSComponentInterface,
16f7022b 126 videojsUntyped,
6e46de09 127 VideoJSCaption,
2adfc7ea
C
128 UserWatching,
129 PeerTubePluginOptions,
130 WebtorrentPluginOptions,
131 P2PMediaLoaderPluginOptions,
132 VideoJSPluginOptions,
133 LoadedQualityData
c6352f2c 134}