]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/assets/player/peertube-videojs-typings.ts
Add/update/delete/list my playlists
[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
1f6824c9 44 startTime: number | string
6e46de09
C
45
46 userWatching?: UserWatching
2adfc7ea
C
47 subtitle?: string
48
49 videoCaptions: VideoJSCaption[]
50}
51
52type WebtorrentPluginOptions = {
53 playerElement: HTMLVideoElement
54
55 autoplay: boolean
56 videoDuration: number
57
58 videoFiles: VideoFile[]
59}
60
61type P2PMediaLoaderPluginOptions = {
09209296 62 redundancyBaseUrls: string[]
2adfc7ea
C
63 type: string
64 src: string
65}
66
67type VideoJSPluginOptions = {
68 peertube: PeerTubePluginOptions
69
70 webtorrent?: WebtorrentPluginOptions
71
72 p2pMediaLoader?: P2PMediaLoaderPluginOptions
c6352f2c
C
73}
74
75// videojs typings don't have some method we need
76const videojsUntyped = videojs as any
77
2adfc7ea
C
78type LoadedQualityData = {
79 qualitySwitchCallback: Function,
80 qualityData: {
81 video: {
82 id: number
83 label: string
84 selected: boolean
85 }[]
86 }
87}
88
89type ResolutionUpdateData = {
90 auto: boolean,
91 resolutionId: number
3b6f205c 92 id?: number
2adfc7ea
C
93}
94
95type AutoResolutionUpdateData = {
96 possible: boolean
97}
98
3b6f205c 99type PlayerNetworkInfo = {
09209296
C
100 http: {
101 downloadSpeed: number
102 uploadSpeed: number
103 downloaded: number
104 uploaded: number
105 }
106
3b6f205c
C
107 p2p: {
108 downloadSpeed: number
109 uploadSpeed: number
110 downloaded: number
111 uploaded: number
112 numPeers: number
113 }
114}
115
c6352f2c 116export {
3b6f205c 117 PlayerNetworkInfo,
2adfc7ea
C
118 ResolutionUpdateData,
119 AutoResolutionUpdateData,
c6352f2c 120 VideoJSComponentInterface,
16f7022b 121 videojsUntyped,
6e46de09 122 VideoJSCaption,
2adfc7ea
C
123 UserWatching,
124 PeerTubePluginOptions,
125 WebtorrentPluginOptions,
126 P2PMediaLoaderPluginOptions,
127 VideoJSPluginOptions,
128 LoadedQualityData
c6352f2c 129}