X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fassets%2Fplayer%2Fpeertube-videojs-typings.ts;h=79a5a6c4d6c7c8bd2aec7baad21d4e4fa5e89ddf;hb=092092969633bbcf6d4891a083ea497a7d5c3154;hp=9c029923772beb0452778e80e99bce681bbbe7c4;hpb=16f7022b06fb76c0b00c23c970bc8df605b0ec63;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/assets/player/peertube-videojs-typings.ts b/client/src/assets/player/peertube-videojs-typings.ts index 9c0299237..79a5a6c4d 100644 --- a/client/src/assets/player/peertube-videojs-typings.ts +++ b/client/src/assets/player/peertube-videojs-typings.ts @@ -1,19 +1,27 @@ +// FIXME: something weird with our path definition in tsconfig and typings +// @ts-ignore import * as videojs from 'video.js' + import { VideoFile } from '../../../../shared/models/videos/video.model' -import { PeerTubePlugin } from './peertube-videojs-plugin' +import { PeerTubePlugin } from './peertube-plugin' +import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin' +import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin' +import { PlayerMode } from './peertube-player-manager' declare namespace videojs { interface Player { peertube (): PeerTubePlugin + webtorrent (): WebTorrentPlugin + p2pMediaLoader (): P2pMediaLoaderPlugin } } interface VideoJSComponentInterface { _player: videojs.Player - new (player: videojs.Player, options?: any) + new (player: videojs.Player, options?: any): any - registerComponent (name: string, obj: any) + registerComponent (name: string, obj: any): any } type VideoJSCaption = { @@ -22,22 +30,100 @@ type VideoJSCaption = { src: string } -type PeertubePluginOptions = { - videoFiles: VideoFile[] - playerElement: HTMLVideoElement +type UserWatching = { + url: string, + authorizationHeader: string +} + +type PeerTubePluginOptions = { + mode: PlayerMode + + autoplay: boolean videoViewUrl: string videoDuration: number - startTime: number - autoplay: boolean, + startTime: number | string + + userWatching?: UserWatching + subtitle?: string + videoCaptions: VideoJSCaption[] } +type WebtorrentPluginOptions = { + playerElement: HTMLVideoElement + + autoplay: boolean + videoDuration: number + + videoFiles: VideoFile[] +} + +type P2PMediaLoaderPluginOptions = { + redundancyBaseUrls: string[] + type: string + src: string +} + +type VideoJSPluginOptions = { + peertube: PeerTubePluginOptions + + webtorrent?: WebtorrentPluginOptions + + p2pMediaLoader?: P2PMediaLoaderPluginOptions +} + // videojs typings don't have some method we need const videojsUntyped = videojs as any +type LoadedQualityData = { + qualitySwitchCallback: Function, + qualityData: { + video: { + id: number + label: string + selected: boolean + }[] + } +} + +type ResolutionUpdateData = { + auto: boolean, + resolutionId: number + id?: number +} + +type AutoResolutionUpdateData = { + possible: boolean +} + +type PlayerNetworkInfo = { + http: { + downloadSpeed: number + uploadSpeed: number + downloaded: number + uploaded: number + } + + p2p: { + downloadSpeed: number + uploadSpeed: number + downloaded: number + uploaded: number + numPeers: number + } +} + export { + PlayerNetworkInfo, + ResolutionUpdateData, + AutoResolutionUpdateData, VideoJSComponentInterface, - PeertubePluginOptions, videojsUntyped, - VideoJSCaption + VideoJSCaption, + UserWatching, + PeerTubePluginOptions, + WebtorrentPluginOptions, + P2PMediaLoaderPluginOptions, + VideoJSPluginOptions, + LoadedQualityData }