]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/peertube-videojs-typings.ts
Merge branch 'release/3.4.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-videojs-typings.ts
index d3c75990b94235f44b307a818c08106a1487cf7e..bd6db4ffc69c0f2a3caadf8384c79a5bfb637bbb 100644 (file)
@@ -1,15 +1,16 @@
-import { Config, Level } from 'hls.js'
+import { HlsConfig, Level } from 'hls.js'
 import videojs from 'video.js'
 import { VideoFile, VideoPlaylist, VideoPlaylistElement } from '@shared/models'
 import { P2pMediaLoaderPlugin } from './p2p-media-loader/p2p-media-loader-plugin'
 import { RedundancyUrlManager } from './p2p-media-loader/redundancy-url-manager'
 import { PlayerMode } from './peertube-player-manager'
 import { PeerTubePlugin } from './peertube-plugin'
+import { PeerTubeResolutionsPlugin } from './peertube-resolutions-plugin'
 import { PlaylistPlugin } from './playlist/playlist-plugin'
-import { EndCardOptions } from './upnext/end-card'
 import { StatsCardOptions } from './stats/stats-card'
-import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
 import { StatsForNerdsPlugin } from './stats/stats-plugin'
+import { EndCardOptions } from './upnext/end-card'
+import { WebTorrentPlugin } from './webtorrent/webtorrent-plugin'
 
 declare module 'video.js' {
 
@@ -34,16 +35,15 @@ declare module 'video.js' {
 
     p2pMediaLoader (): P2pMediaLoaderPlugin
 
+    peertubeResolutions (): PeerTubeResolutionsPlugin
+
     contextmenuUI (options: any): any
 
     bezels (): void
 
     stats (options?: StatsCardOptions): StatsForNerdsPlugin
 
-    qualityLevels (): QualityLevels
-
     textTracks (): TextTrackList & {
-      on: Function
       tracks_: (TextTrack & { id: string, label: string, src: string })[]
     }
 
@@ -60,30 +60,22 @@ export interface VideoJSTechHLS extends videojs.Tech {
 }
 
 export interface HlsjsConfigHandlerOptions {
-  hlsjsConfig?: Config & { cueHandler: any }// FIXME: typings
+  hlsjsConfig?: HlsConfig & { cueHandler: any }// FIXME: typings
   captionConfig?: any // FIXME: typings
 
   levelLabelHandler?: (level: Level) => string
 }
 
-type QualityLevelRepresentation = {
+type PeerTubeResolution = {
   id: number
-  height: 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
+  selected: boolean
+  selectCallback: () => void
 }
 
 type VideoJSCaption = {
@@ -93,7 +85,7 @@ type VideoJSCaption = {
 }
 
 type UserWatching = {
-  url: string,
+  url: string
   authorizationHeader: string
 }
 
@@ -128,7 +120,7 @@ type PlaylistPluginOptions = {
 
 type NextPreviousVideoButtonOptions = {
   type: 'next' | 'previous'
-  handler: Function
+  handler: () => void
   isDisabled: () => boolean
 }
 
@@ -166,7 +158,7 @@ type VideoJSPluginOptions = {
 }
 
 type LoadedQualityData = {
-  qualitySwitchCallback: Function,
+  qualitySwitchCallback: (resolutionId: number, type: 'video') => void
   qualityData: {
     video: {
       id: number
@@ -177,7 +169,7 @@ type LoadedQualityData = {
 }
 
 type ResolutionUpdateData = {
-  auto: boolean,
+  auto: boolean
   resolutionId: number
   id?: number
 }
@@ -211,7 +203,7 @@ type PlayerNetworkInfo = {
 type PlaylistItemOptions = {
   element: VideoPlaylistElement
 
-  onClicked: Function
+  onClicked: () => void
 }
 
 export {
@@ -226,9 +218,8 @@ export {
   PeerTubePluginOptions,
   WebtorrentPluginOptions,
   P2PMediaLoaderPluginOptions,
+  PeerTubeResolution,
   VideoJSPluginOptions,
   LoadedQualityData,
-  QualityLevelRepresentation,
-  PeerTubeLinkButtonOptions,
-  QualityLevels
+  PeerTubeLinkButtonOptions
 }