2021-01-08 16:21:27 +01:00
|
|
|
// @flow
|
|
|
|
import type { Player } from './videojs';
|
2021-09-02 22:05:32 +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-09-02 22:05:32 +02:00
|
|
|
const controlBar = player.getChild('controlBar');
|
|
|
|
|
|
|
|
const theaterMode = new TheaterModeButton(player, {
|
|
|
|
name: 'TheaterModeButton',
|
|
|
|
text: 'Theater mode',
|
2021-01-08 16:21:27 +01:00
|
|
|
clickHandler: () => {
|
|
|
|
toggleVideoTheaterMode();
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2021-09-02 22:05:32 +02:00
|
|
|
controlBar.addChild(theaterMode);
|
2021-01-08 16:21:27 +01:00
|
|
|
}
|