1 import { PeerTubePlugin } from './peertube-plugin'
2 import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
3 import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
4 import { PlayerMode } from './peertube-player-manager'
5 import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
6 import { VideoFile } from '@shared/models'
7 import videojs from 'video.js'
8 import { Config, Level } from 'hls.js'
10 declare module 'video.js' {
12 export interface VideoJsPlayer {
13 srOptions_: HlsjsConfigHandlerOptions
15 theaterEnabled: boolean
17 // FIXME: add it to upstream typings
23 handleTechSeeked_ (): void
27 peertube (): PeerTubePlugin
29 webtorrent (): WebTorrentPlugin
31 p2pMediaLoader (): P2pMediaLoaderPlugin
33 contextmenuUI (options: any): any
37 qualityLevels (): QualityLevels
39 textTracks (): TextTrackList & {
41 tracks_: (TextTrack & { id: string, label: string, src: string })[]
44 dock (options: { title: string, description: string }): void
48 export interface VideoJSTechHLS extends videojs.Tech {
49 hlsProvider: any // FIXME: typings
52 export interface HlsjsConfigHandlerOptions {
53 hlsjsConfig?: Config & { cueHandler: any }// FIXME: typings
54 captionConfig?: any // FIXME: typings
56 levelLabelHandler?: (level: Level) => string
59 type QualityLevelRepresentation = {
72 type QualityLevels = QualityLevelRepresentation[] & {
74 selectedIndex_: number
76 addQualityLevel (representation: QualityLevelRepresentation): void
79 type VideoJSCaption = {
87 authorizationHeader: string
90 type PeerTubePluginOptions = {
97 userWatching?: UserWatching
100 videoCaptions: VideoJSCaption[]
102 stopTime: number | string
105 type WebtorrentPluginOptions = {
106 playerElement: HTMLVideoElement
109 videoDuration: number
111 videoFiles: VideoFile[]
113 startTime: number | string
116 type P2PMediaLoaderPluginOptions = {
117 redundancyUrlManager: RedundancyUrlManager
121 startTime: number | string
124 type VideoJSPluginOptions = {
125 peertube: PeerTubePluginOptions
127 webtorrent?: WebtorrentPluginOptions
129 p2pMediaLoader?: P2PMediaLoaderPluginOptions
132 type LoadedQualityData = {
133 qualitySwitchCallback: Function,
143 type ResolutionUpdateData = {
149 type AutoResolutionUpdateData = {
153 type PlayerNetworkInfo = {
155 downloadSpeed: number
162 downloadSpeed: number
172 ResolutionUpdateData,
173 AutoResolutionUpdateData,
176 PeerTubePluginOptions,
177 WebtorrentPluginOptions,
178 P2PMediaLoaderPluginOptions,
179 VideoJSPluginOptions,
181 QualityLevelRepresentation,