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,
23 peertubeLink: boolean,
26 const videojsOptions = {
28 poster: options.poster,
29 autoplay: options.autoplay,
30 inactivityTimeout: options.inactivityTimeout,
31 playbackRates: [ 0.5, 1, 1.5, 2 ],
34 videoFiles: options.videoFiles,
35 playerElement: options.playerElement,
36 videoViewUrl: options.videoViewUrl,
37 videoDuration: options.videoDuration
41 children: getControlBarChildren(options)
45 if (options.enableHotkeys === true) {
46 Object.assign(videojsOptions.plugins, {
48 enableVolumeScroll: false
56 function getControlBarChildren (options: {
61 'currentTimeDisplay': {},
63 'durationDisplay': {},
66 'flexibleWidthSpacer': {},
67 'progressControl': {},
69 'webTorrentButton': {},
79 'resolutionMenuButton',
80 'playbackRateMenuButton'
85 if (options.peertubeLink === true) {
86 Object.assign(children, {
87 'peerTubeLinkButton': {}
91 Object.assign(children, {
92 'fullscreenToggle': {}
98 export { getVideojsOptions }