1 // FIXME: something weird with our path definition in tsconfig and typings
3 import * as videojs from 'video.js'
5 import { VideoFile } from '../../../../shared/models/videos/video.model'
6 import { PeerTubePlugin } from './peertube-plugin'
7 import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
8 import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
9 import { PlayerMode } from './peertube-player-manager'
11 declare namespace videojs {
13 peertube (): PeerTubePlugin
14 webtorrent (): WebTorrentPlugin
15 p2pMediaLoader (): P2pMediaLoaderPlugin
19 interface VideoJSComponentInterface {
20 _player: videojs.Player
22 new (player: videojs.Player, options?: any): any
24 registerComponent (name: string, obj: any): any
27 type VideoJSCaption = {
35 authorizationHeader: string
38 type PeerTubePluginOptions = {
45 userWatching?: UserWatching
48 videoCaptions: VideoJSCaption[]
50 stopTime: number | string
53 type WebtorrentPluginOptions = {
54 playerElement: HTMLVideoElement
59 videoFiles: VideoFile[]
61 startTime: number | string
64 type P2PMediaLoaderPluginOptions = {
65 redundancyBaseUrls: string[]
69 startTime: number | string
72 type VideoJSPluginOptions = {
73 peertube: PeerTubePluginOptions
75 webtorrent?: WebtorrentPluginOptions
77 p2pMediaLoader?: P2PMediaLoaderPluginOptions
80 // videojs typings don't have some method we need
81 const videojsUntyped = videojs as any
83 type LoadedQualityData = {
84 qualitySwitchCallback: Function,
94 type ResolutionUpdateData = {
100 type AutoResolutionUpdateData = {
104 type PlayerNetworkInfo = {
106 downloadSpeed: number
113 downloadSpeed: number
123 ResolutionUpdateData,
124 AutoResolutionUpdateData,
125 VideoJSComponentInterface,
129 PeerTubePluginOptions,
130 WebtorrentPluginOptions,
131 P2PMediaLoaderPluginOptions,
132 VideoJSPluginOptions,