- const videojsOptions = getVideojsOptions({
- autoplay: this.autoplay,
- controls: this.controls,
- muted: this.muted,
- loop: this.loop,
- startTime: this.startTime,
-
- videoCaptions,
- inactivityTimeout: 1500,
- videoViewUrl: this.getVideoUrl(videoId) + '/views',
- playerElement: this.videoElement,
- videoFiles: videoInfo.files,
- videoDuration: videoInfo.duration,
- enableHotkeys: true,
- peertubeLink: true,
- poster: window.location.origin + videoInfo.previewPath,
- theaterMode: false
- })
+ const options: PeertubePlayerManagerOptions = {
+ common: {
+ autoplay: this.autoplay,
+ controls: this.controls,
+ muted: this.muted,
+ loop: this.loop,
+ captions: videoCaptions.length !== 0,
+ startTime: this.startTime,
+ stopTime: this.stopTime,
+ subtitle: this.subtitle,
+
+ videoCaptions,
+ inactivityTimeout: 1500,
+ videoViewUrl: this.getVideoUrl(videoId) + '/views',
+
+ playerElement: this.videoElement,
+ onPlayerElementChange: (element: HTMLVideoElement) => this.videoElement = element,
+
+ videoDuration: videoInfo.duration,
+ enableHotkeys: true,
+ peertubeLink: true,
+ poster: window.location.origin + videoInfo.previewPath,
+ theaterMode: false,
+
+ serverUrl: window.location.origin,
+ language: navigator.language,
+ embedUrl: window.location.origin + videoInfo.embedPath
+ },
+
+ webtorrent: {
+ videoFiles: videoInfo.files
+ }
+ }