aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/assets/player/peertube-videojs-typings.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2019-01-23 15:36:45 +0100
committerChocobozzz <chocobozzz@cpy.re>2019-02-11 09:13:02 +0100
commit2adfc7ea9a1f858db874df9fe322e7ae833db77c (patch)
treee27c6ebe01b7c96ea0e053839a38fc1f824d1284 /client/src/assets/player/peertube-videojs-typings.ts
parent7eeb6a0ba4028d0e20847b846332dd0b7747c7f8 (diff)
downloadPeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.tar.gz
PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.tar.zst
PeerTube-2adfc7ea9a1f858db874df9fe322e7ae833db77c.zip
Refractor videojs player
Add fake p2p-media-loader plugin
Diffstat (limited to 'client/src/assets/player/peertube-videojs-typings.ts')
-rw-r--r--client/src/assets/player/peertube-videojs-typings.ts67
1 files changed, 58 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..060ea4dce 100644
--- a/client/src/assets/player/peertube-videojs-typings.ts
+++ b/client/src/assets/player/peertube-videojs-typings.ts
@@ -3,11 +3,13 @@
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-plugin'
7 8
8declare namespace videojs { 9declare namespace videojs {
9 interface Player { 10 interface Player {
10 peertube (): PeerTubePlugin 11 peertube (): PeerTubePlugin
12 webtorrent (): WebTorrentPlugin
11 } 13 }
12} 14}
13 15
@@ -30,26 +32,73 @@ type UserWatching = {
30 authorizationHeader: string 32 authorizationHeader: string
31} 33}
32 34
33type PeertubePluginOptions = { 35type PeerTubePluginOptions = {
34 videoFiles: VideoFile[] 36 autoplay: boolean
35 playerElement: HTMLVideoElement
36 videoViewUrl: string 37 videoViewUrl: string
37 videoDuration: number 38 videoDuration: number
38 startTime: number | string 39 startTime: number | string
39 autoplay: boolean,
40 videoCaptions: VideoJSCaption[]
41 40
42 subtitle?: string
43 userWatching?: UserWatching 41 userWatching?: UserWatching
42 subtitle?: string
43
44 videoCaptions: VideoJSCaption[]
45}
46
47type WebtorrentPluginOptions = {
48 playerElement: HTMLVideoElement
49
50 autoplay: boolean
51 videoDuration: number
52
53 videoFiles: VideoFile[]
54}
55
56type P2PMediaLoaderPluginOptions = {
57 type: string
58 src: string
59}
60
61type VideoJSPluginOptions = {
62 peertube: PeerTubePluginOptions
63
64 webtorrent?: WebtorrentPluginOptions
65
66 p2pMediaLoader?: P2PMediaLoaderPluginOptions
44} 67}
45 68
46// videojs typings don't have some method we need 69// videojs typings don't have some method we need
47const videojsUntyped = videojs as any 70const videojsUntyped = videojs as any
48 71
72type LoadedQualityData = {
73 qualitySwitchCallback: Function,
74 qualityData: {
75 video: {
76 id: number
77 label: string
78 selected: boolean
79 }[]
80 }
81}
82
83type ResolutionUpdateData = {
84 auto: boolean,
85 resolutionId: number
86}
87
88type AutoResolutionUpdateData = {
89 possible: boolean
90}
91
49export { 92export {
93 ResolutionUpdateData,
94 AutoResolutionUpdateData,
50 VideoJSComponentInterface, 95 VideoJSComponentInterface,
51 PeertubePluginOptions,
52 videojsUntyped, 96 videojsUntyped,
53 VideoJSCaption, 97 VideoJSCaption,
54 UserWatching 98 UserWatching,
99 PeerTubePluginOptions,
100 WebtorrentPluginOptions,
101 P2PMediaLoaderPluginOptions,
102 VideoJSPluginOptions,
103 LoadedQualityData
55} 104}