]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/assets/player/peertube-videojs-typings.ts
Set last subtitle or subtitle in URL
[github/Chocobozzz/PeerTube.git] / client / src / assets / player / peertube-videojs-typings.ts
index abdf333e11244f4ec5d44f80dc6db4d4421a26ab..634c7fdc9df0e38484c31cebe5ed2b0b1b721c49 100644 (file)
@@ -1,8 +1,11 @@
+// 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'
 
-declare module 'video.js' {
+declare namespace videojs {
   interface Player {
     peertube (): PeerTubePlugin
   }
@@ -11,9 +14,20 @@ declare module 'video.js' {
 interface VideoJSComponentInterface {
   _player: videojs.Player
 
-  new (player: videojs.Player, options?: any)
+  new (player: videojs.Player, options?: any): any
+
+  registerComponent (name: string, obj: any): any
+}
+
+type VideoJSCaption = {
+  label: string
+  language: string
+  src: string
+}
 
-  registerComponent (name: string, obj: any)
+type UserWatching = {
+  url: string,
+  authorizationHeader: string
 }
 
 type PeertubePluginOptions = {
@@ -21,8 +35,12 @@ type PeertubePluginOptions = {
   playerElement: HTMLVideoElement
   videoViewUrl: string
   videoDuration: number
-  startTime: number
-  autoplay: boolean
+  startTime: number | string
+  autoplay: boolean,
+  videoCaptions: VideoJSCaption[]
+
+  subtitle?: string
+  userWatching?: UserWatching
 }
 
 // videojs typings don't have some method we need
@@ -31,5 +49,7 @@ const videojsUntyped = videojs as any
 export {
   VideoJSComponentInterface,
   PeertubePluginOptions,
-  videojsUntyped
+  videojsUntyped,
+  VideoJSCaption,
+  UserWatching
 }