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 = {
44 startTime: number | string
46 userWatching?: UserWatching
49 videoCaptions: VideoJSCaption[]
52 type WebtorrentPluginOptions = {
53 playerElement: HTMLVideoElement
58 videoFiles: VideoFile[]
61 type P2PMediaLoaderPluginOptions = {
62 redundancyBaseUrls: string[]
67 type VideoJSPluginOptions = {
68 peertube: PeerTubePluginOptions
70 webtorrent?: WebtorrentPluginOptions
72 p2pMediaLoader?: P2PMediaLoaderPluginOptions
75 // videojs typings don't have some method we need
76 const videojsUntyped = videojs as any
78 type LoadedQualityData = {
79 qualitySwitchCallback: Function,
89 type ResolutionUpdateData = {
95 type AutoResolutionUpdateData = {
99 type PlayerNetworkInfo = {
101 downloadSpeed: number
108 downloadSpeed: number
118 ResolutionUpdateData,
119 AutoResolutionUpdateData,
120 VideoJSComponentInterface,
124 PeerTubePluginOptions,
125 WebtorrentPluginOptions,
126 P2PMediaLoaderPluginOptions,
127 VideoJSPluginOptions,