1 import { VideoFile } from '../../../../shared/models/videos'
3 import 'videojs-hotkeys'
4 import 'videojs-dock/dist/videojs-dock.es.js'
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,
25 const videojsOptions = {
27 autoplay: options.autoplay,
28 inactivityTimeout: options.inactivityTimeout,
29 playbackRates: [ 0.5, 1, 1.5, 2 ],
32 videoFiles: options.videoFiles,
33 playerElement: options.playerElement,
34 videoViewUrl: options.videoViewUrl,
35 videoDuration: options.videoDuration
39 children: getControlBarChildren(options)
43 if (options.enableHotkeys === true) {
44 Object.assign(videojsOptions.plugins, {
46 enableVolumeScroll: false
54 function getControlBarChildren (options: {
59 'currentTimeDisplay': {},
61 'durationDisplay': {},
64 'flexibleWidthSpacer': {},
65 'progressControl': {},
67 'webTorrentButton': {},
77 'resolutionMenuButton',
78 'playbackRateMenuButton'
83 if (options.peertubeLink === true) {
84 Object.assign(children, {
85 'peerTubeLinkButton': {}
89 Object.assign(children, {
90 'fullscreenToggle': {}
96 export { getVideojsOptions }