1 import { VideoFile } from '../../../../shared/models/videos'
3 import 'core-js/es6/symbol';
4 import 'core-js/es6/object';
5 import 'core-js/es6/function';
6 import 'core-js/es6/parse-int';
7 import 'core-js/es6/parse-float';
8 import 'core-js/es6/number';
9 import 'core-js/es6/math';
10 import 'core-js/es6/string';
11 import 'core-js/es6/date';
12 import 'core-js/es6/array';
13 import 'core-js/es6/regexp';
14 import 'core-js/es6/map';
15 import 'core-js/es6/weak-map';
16 import 'core-js/es6/set';
17 import 'core-js/es7/object';
19 import 'videojs-hotkeys'
21 import './peertube-link-button'
22 import './resolution-menu-button'
23 import './settings-menu-button'
24 import './webtorrent-info-button'
25 import './peertube-videojs-plugin'
26 import { videojsUntyped } from './peertube-videojs-typings'
28 // Change 'Playback Rate' to 'Speed' (smaller for our settings menu)
29 videojsUntyped.getComponent('PlaybackRateMenuButton').prototype.controlText_ = 'Speed'
31 function getVideojsOptions (options: {
33 playerElement: HTMLVideoElement,
35 videoDuration: number,
36 videoFiles: VideoFile[],
37 enableHotkeys: boolean,
38 inactivityTimeout: number,
39 peertubeLink: boolean,
43 const videojsOptions = {
45 poster: options.poster,
47 inactivityTimeout: options.inactivityTimeout,
48 playbackRates: [ 0.5, 1, 1.5, 2 ],
51 autoplay: options.autoplay, // Use peertube plugin autoplay because we get the file by webtorrent
52 videoFiles: options.videoFiles,
53 playerElement: options.playerElement,
54 videoViewUrl: options.videoViewUrl,
55 videoDuration: options.videoDuration,
56 startTime: options.startTime
60 children: getControlBarChildren(options)
64 if (options.enableHotkeys === true) {
65 Object.assign(videojsOptions.plugins, {
67 enableVolumeScroll: false
75 function getControlBarChildren (options: {
80 'currentTimeDisplay': {},
82 'durationDisplay': {},
85 'flexibleWidthSpacer': {},
86 'progressControl': {},
88 'webTorrentButton': {},
98 'resolutionMenuButton',
99 'playbackRateMenuButton'
104 if (options.peertubeLink === true) {
105 Object.assign(children, {
106 'peerTubeLinkButton': {}
110 Object.assign(children, {
111 'fullscreenToggle': {}
117 export { getVideojsOptions }