1 import { VideoFile } from '../../../../shared/models/videos'
3 import 'videojs-hotkeys'
5 import './peertube-link-button'
6 import './resolution-menu-button'
7 import './settings-menu-button'
8 import './webtorrent-info-button'
9 import './peertube-videojs-plugin'
10 import { videojsUntyped } from './peertube-videojs-typings'
12 // Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
13 videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
15 function getVideojsOptions (options: {
17 playerElement: HTMLVideoElement,
19 videoDuration: number,
20 videoFiles: VideoFile[],
21 enableHotkeys: boolean,
22 inactivityTimeout: number,
23 peertubeLink: boolean,
27 const videojsOptions = {
29 poster: options.poster,
31 inactivityTimeout: options.inactivityTimeout,
32 playbackRates: [ 0.5, 1, 1.5, 2 ],
35 autoplay: options.autoplay, // Use peertube plugin autoplay because we get the file by webtorrent
36 videoFiles: options.videoFiles,
37 playerElement: options.playerElement,
38 videoViewUrl: options.videoViewUrl,
39 videoDuration: options.videoDuration,
40 startTime: options.startTime
44 children: getControlBarChildren(options)
48 if (options.enableHotkeys === true) {
49 Object.assign(videojsOptions.plugins, {
51 enableVolumeScroll: false
59 function getControlBarChildren (options: {
64 'currentTimeDisplay': {},
66 'durationDisplay': {},
69 'flexibleWidthSpacer': {},
70 'progressControl': {},
72 'webTorrentButton': {},
82 'resolutionMenuButton',
83 'playbackRateMenuButton'
88 if (options.peertubeLink === true) {
89 Object.assign(children, {
90 'peerTubeLinkButton': {}
94 Object.assign(children, {
95 'fullscreenToggle': {}
101 export { getVideojsOptions }