2015-05-18 17:35:21 -07:00
|
|
|
import Button from '../button.js';
|
|
|
|
import Component from '../component.js';
|
2015-03-10 18:01:11 -07:00
|
|
|
|
2013-05-02 19:03:29 -07:00
|
|
|
/**
|
|
|
|
* Toggle fullscreen video
|
2015-04-22 15:26:37 -07:00
|
|
|
* @param {Player|Object} player
|
2013-05-02 19:03:29 -07:00
|
|
|
* @param {Object=} options
|
2013-10-28 18:25:28 -07:00
|
|
|
* @class
|
|
|
|
* @extends vjs.Button
|
2013-05-02 19:03:29 -07:00
|
|
|
*/
|
2015-04-14 13:08:32 -07:00
|
|
|
class FullscreenToggle extends Button {
|
2013-05-02 19:03:29 -07:00
|
|
|
|
2015-04-14 13:08:32 -07:00
|
|
|
buildCSSClass() {
|
2015-04-22 15:26:37 -07:00
|
|
|
return `vjs-fullscreen-control ${super.buildCSSClass()}`;
|
2015-04-14 13:08:32 -07:00
|
|
|
}
|
2015-03-10 18:01:11 -07:00
|
|
|
|
2015-04-29 10:17:46 -07:00
|
|
|
handleClick() {
|
2015-04-14 13:08:32 -07:00
|
|
|
if (!this.player_.isFullscreen()) {
|
|
|
|
this.player_.requestFullscreen();
|
|
|
|
this.controlText_.innerHTML = this.localize('Non-Fullscreen');
|
|
|
|
} else {
|
|
|
|
this.player_.exitFullscreen();
|
|
|
|
this.controlText_.innerHTML = this.localize('Fullscreen');
|
|
|
|
}
|
|
|
|
}
|
2013-05-02 19:03:29 -07:00
|
|
|
|
2015-04-14 13:08:32 -07:00
|
|
|
}
|
2013-05-02 19:03:29 -07:00
|
|
|
|
2015-04-14 13:08:32 -07:00
|
|
|
FullscreenToggle.prototype.buttonText = 'Fullscreen';
|
2015-03-10 18:01:11 -07:00
|
|
|
|
2015-05-18 17:35:21 -07:00
|
|
|
Component.registerComponent('FullscreenToggle', FullscreenToggle);
|
2015-03-10 18:01:11 -07:00
|
|
|
export default FullscreenToggle;
|