2021-01-08 16:21:27 +01:00
|
|
|
// @flow
|
|
|
|
import type { Player } from './videojs';
|
2021-08-24 12:36:08 +02:00
|
|
|
import videojs from 'video.js';
|
|
|
|
|
|
|
|
class TheaterModeButton extends videojs.getComponent('Button') {
|
|
|
|
constructor(player, options = {}) {
|
|
|
|
super(player, options);
|
|
|
|
this.addClass('vjs-button--theater-mode');
|
|
|
|
this.controlText('Theater Mode');
|
|
|
|
}
|
|
|
|
}
|
2021-01-08 16:21:27 +01:00
|
|
|
|
|
|
|
export function addTheaterModeButton(player: Player, toggleVideoTheaterMode: () => void) {
|
2021-08-24 12:36:08 +02:00
|
|
|
const controlBar = player.getChild('controlBar');
|
|
|
|
|
|
|
|
const theaterMode = new TheaterModeButton(player, {
|
|
|
|
name: 'TheaterModeButton',
|
2021-01-08 16:21:27 +01:00
|
|
|
text: __('Theater mode'),
|
|
|
|
clickHandler: () => {
|
|
|
|
toggleVideoTheaterMode();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-08-24 12:36:08 +02:00
|
|
|
controlBar.addChild(theaterMode);
|
2021-01-08 16:21:27 +01:00
|
|
|
}
|