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,
27 const videojsOptions = {
29 poster: options.poster,
30 autoplay: options.autoplay,
31 inactivityTimeout: options.inactivityTimeout,
32 playbackRates: [ 0.5, 1, 1.5, 2 ],
35 videoFiles: options.videoFiles,
36 playerElement: options.playerElement,
37 videoViewUrl: options.videoViewUrl,
38 videoDuration: options.videoDuration,
39 startTime: options.startTime
43 children: getControlBarChildren(options)
47 if (options.enableHotkeys === true) {
48 Object.assign(videojsOptions.plugins, {
50 enableVolumeScroll: false
58 function getControlBarChildren (options: {
63 'currentTimeDisplay': {},
65 'durationDisplay': {},
68 'flexibleWidthSpacer': {},
69 'progressControl': {},
71 'webTorrentButton': {},
81 'resolutionMenuButton',
82 'playbackRateMenuButton'
87 if (options.peertubeLink === true) {
88 Object.assign(children, {
89 'peerTubeLinkButton': {}
93 Object.assign(children, {
94 'fullscreenToggle': {}
100 export { getVideojsOptions }