aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-typings.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/assets/player/peertube-videojs-typings.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-typings.ts92
1 files changed, 83 insertions, 9 deletions
diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts
index 634c7fdc9..79a5a6c4d 100644
--- a/client/src/assets/player/peertube-videojs-typings.ts
+++ b/client/src/assets/player/peertube-videojs-typings.ts
@@ -3,11 +3,16 @@
3import * as videojs from 'video.js' 3import * as videojs from 'video.js'
4 4
5import { VideoFile } from '../../../../shared/models/videos/video.model' 5import { VideoFile } from '../../../../shared/models/videos/video.model'
6import { PeerTubePlugin } from './peertube-videojs-plugin' 6import { PeerTubePlugin } from './peertube-plugin'
7import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
8import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
9import { PlayerMode } from './peertube-player-manager'
7 10
8declare namespace videojs { 11declare namespace videojs {
9 interface Player { 12 interface Player {
10 peertube (): PeerTubePlugin 13 peertube (): PeerTubePlugin
14 webtorrent (): WebTorrentPlugin
15 p2pMediaLoader (): P2pMediaLoaderPlugin
11 } 16 }
12} 17}
13 18
@@ -30,26 +35,95 @@ type UserWatching = {
30 authorizationHeader: string 35 authorizationHeader: string
31} 36}
32 37
33type PeertubePluginOptions = { 38type PeerTubePluginOptions = {
34 videoFiles: VideoFile[] 39 mode: PlayerMode
35 playerElement: HTMLVideoElement 40
41 autoplay: boolean
36 videoViewUrl: string 42 videoViewUrl: string
37 videoDuration: number 43 videoDuration: number
38 startTime: number | string 44 startTime: number | string
39 autoplay: boolean,
40 videoCaptions: VideoJSCaption[]
41 45
42 subtitle?: string
43 userWatching?: UserWatching 46 userWatching?: UserWatching
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 = {
62 redundancyBaseUrls: string[]
63 type: string
64 src: string
65}
66
67type VideoJSPluginOptions = {
68 peertube: PeerTubePluginOptions
69
70 webtorrent?: WebtorrentPluginOptions
71
72 p2pMediaLoader?: P2PMediaLoaderPluginOptions
44} 73}
45 74
46// videojs typings don't have some method we need 75// videojs typings don't have some method we need
47const videojsUntyped = videojs as any 76const videojsUntyped = videojs as any
48 77
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
92 id?: number
93}
94
95type AutoResolutionUpdateData = {
96 possible: boolean
97}
98
99type PlayerNetworkInfo = {
100 http: {
101 downloadSpeed: number
102 uploadSpeed: number
103 downloaded: number
104 uploaded: number
105 }
106
107 p2p: {
108 downloadSpeed: number
109 uploadSpeed: number
110 downloaded: number
111 uploaded: number
112 numPeers: number
113 }
114}
115
49export { 116export {
117 PlayerNetworkInfo,
118 ResolutionUpdateData,
119 AutoResolutionUpdateData,
50 VideoJSComponentInterface, 120 VideoJSComponentInterface,
51 PeertubePluginOptions,
52 videojsUntyped, 121 videojsUntyped,
53 VideoJSCaption, 122 VideoJSCaption,
54 UserWatching 123 UserWatching,
124 PeerTubePluginOptions,
125 WebtorrentPluginOptions,
126 P2PMediaLoaderPluginOptions,
127 VideoJSPluginOptions,
128 LoadedQualityData
55} 129}