1
0
Fork 0
peertube/client/src/assets/player/peertube-videojs-typings.ts

186 lines
3.5 KiB
TypeScript
Raw Normal View History

import { PeerTubePlugin } from './peertube-plugin'
2019-01-29 07:37:25 +00:00
import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
import { PlayerMode } from './peertube-player-manager'
2019-08-23 08:19:44 +00:00
import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
import { VideoFile } from '@shared/models'
2020-04-17 09:20:12 +00:00
import videojs from 'video.js/dist/alt/video.core.js'
import { Config, Level } from 'hls.js'
2020-01-28 16:29:50 +00:00
declare module 'video.js' {
2020-01-28 16:29:50 +00:00
export interface VideoJsPlayer {
srOptions_: HlsjsConfigHandlerOptions
2020-01-28 16:29:50 +00:00
theaterEnabled: boolean
// FIXME: add it to upstream typings
posterImage: {
show (): void
hide (): void
}
handleTechSeeked_ (): void
// Plugins
peertube (): PeerTubePlugin
webtorrent (): WebTorrentPlugin
2019-01-29 07:37:25 +00:00
p2pMediaLoader (): P2pMediaLoaderPlugin
2020-01-28 16:29:50 +00:00
contextmenuUI (options: any): any
bezels (): void
qualityLevels (): QualityLevels
2020-01-28 16:29:50 +00:00
textTracks (): TextTrackList & {
on: Function
tracks_: { kind: string, mode: string, language: string }[]
}
audioTracks (): AudioTrackList
2020-02-03 12:33:42 +00:00
dock (options: { title: string, description: string }): void
2020-01-28 16:29:50 +00:00
}
}
export interface VideoJSTechHLS extends videojs.Tech {
hlsProvider: any // FIXME: typings
}
export interface HlsjsConfigHandlerOptions {
hlsjsConfig?: Config & { cueHandler: any }// FIXME: typings
captionConfig?: any // FIXME: typings
levelLabelHandler?: (level: Level) => string
}
type QualityLevelRepresentation = {
id: number
height: number
label?: string
width?: number
bandwidth?: number
bitrate?: number
enabled?: Function
_enabled: boolean
}
type QualityLevels = QualityLevelRepresentation[] & {
selectedIndex: number
selectedIndex_: number
addQualityLevel (representation: QualityLevelRepresentation): void
}
2018-07-13 16:21:19 +00:00
type VideoJSCaption = {
label: string
language: string
src: string
}
2018-10-05 09:15:06 +00:00
type UserWatching = {
url: string,
authorizationHeader: string
}
type PeerTubePluginOptions = {
2019-01-29 07:37:25 +00:00
mode: PlayerMode
autoplay: boolean
videoViewUrl: string
videoDuration: number
2018-10-05 09:15:06 +00:00
userWatching?: UserWatching
subtitle?: string
videoCaptions: VideoJSCaption[]
2019-03-07 16:06:00 +00:00
stopTime: number | string
}
type WebtorrentPluginOptions = {
playerElement: HTMLVideoElement
autoplay: boolean
videoDuration: number
videoFiles: VideoFile[]
2019-03-07 16:06:00 +00:00
startTime: number | string
}
type P2PMediaLoaderPluginOptions = {
2019-08-23 08:19:44 +00:00
redundancyUrlManager: RedundancyUrlManager
type: string
src: string
2019-03-07 16:06:00 +00:00
startTime: number | string
}
type VideoJSPluginOptions = {
peertube: PeerTubePluginOptions
webtorrent?: WebtorrentPluginOptions
p2pMediaLoader?: P2PMediaLoaderPluginOptions
}
type LoadedQualityData = {
qualitySwitchCallback: Function,
qualityData: {
video: {
id: number
label: string
selected: boolean
}[]
}
}
type ResolutionUpdateData = {
auto: boolean,
resolutionId: number
2019-01-24 09:16:30 +00:00
id?: number
}
type AutoResolutionUpdateData = {
possible: boolean
}
2019-01-24 09:16:30 +00:00
type PlayerNetworkInfo = {
2019-01-29 07:37:25 +00:00
http: {
downloadSpeed: number
uploadSpeed: number
downloaded: number
uploaded: number
}
2019-01-24 09:16:30 +00:00
p2p: {
downloadSpeed: number
uploadSpeed: number
downloaded: number
uploaded: number
numPeers: number
}
}
export {
2019-01-24 09:16:30 +00:00
PlayerNetworkInfo,
ResolutionUpdateData,
AutoResolutionUpdateData,
2018-10-05 09:15:06 +00:00
VideoJSCaption,
UserWatching,
PeerTubePluginOptions,
WebtorrentPluginOptions,
P2PMediaLoaderPluginOptions,
VideoJSPluginOptions,
LoadedQualityData,
QualityLevelRepresentation,
QualityLevels
}