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-plugin'
9 declare namespace videojs {
11 peertube (): PeerTubePlugin
12 webtorrent (): WebTorrentPlugin
16 interface VideoJSComponentInterface {
17 _player: videojs.Player
19 new (player: videojs.Player, options?: any): any
21 registerComponent (name: string, obj: any): any
24 type VideoJSCaption = {
32 authorizationHeader: string
35 type PeerTubePluginOptions = {
39 startTime: number | string
41 userWatching?: UserWatching
44 videoCaptions: VideoJSCaption[]
47 type WebtorrentPluginOptions = {
48 playerElement: HTMLVideoElement
53 videoFiles: VideoFile[]
56 type P2PMediaLoaderPluginOptions = {
61 type VideoJSPluginOptions = {
62 peertube: PeerTubePluginOptions
64 webtorrent?: WebtorrentPluginOptions
66 p2pMediaLoader?: P2PMediaLoaderPluginOptions
69 // videojs typings don't have some method we need
70 const videojsUntyped = videojs as any
72 type LoadedQualityData = {
73 qualitySwitchCallback: Function,
83 type ResolutionUpdateData = {
89 type AutoResolutionUpdateData = {
93 type PlayerNetworkInfo = {
105 ResolutionUpdateData,
106 AutoResolutionUpdateData,
107 VideoJSComponentInterface,
111 PeerTubePluginOptions,
112 WebtorrentPluginOptions,
113 P2PMediaLoaderPluginOptions,
114 VideoJSPluginOptions,