2015-06-12 11:31:18 -04:00
|
|
|
/**
|
|
|
|
* @file fullscreen-toggle.js
|
|
|
|
*/
|
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-06-12 11:31:18 -04:00
|
|
|
*
|
|
|
|
* @extends Button
|
|
|
|
* @class FullscreenToggle
|
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-06-12 11:31:18 -04:00
|
|
|
/**
|
|
|
|
* Allow sub components to stack CSS class names
|
|
|
|
*
|
|
|
|
* @return {String} The constructed class name
|
|
|
|
* @method buildCSSClass
|
|
|
|
*/
|
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-06-12 11:31:18 -04:00
|
|
|
/**
|
|
|
|
* Handles click for full screen
|
|
|
|
*
|
|
|
|
* @method handleClick
|
|
|
|
*/
|
2015-04-29 10:17:46 -07:00
|
|
|
handleClick() {
|
2015-04-14 13:08:32 -07:00
|
|
|
if (!this.player_.isFullscreen()) {
|
|
|
|
this.player_.requestFullscreen();
|
2015-05-29 15:56:45 -07:00
|
|
|
this.controlText('Non-Fullscreen');
|
2015-04-14 13:08:32 -07:00
|
|
|
} else {
|
|
|
|
this.player_.exitFullscreen();
|
2015-05-29 15:56:45 -07:00
|
|
|
this.controlText('Fullscreen');
|
2015-04-14 13:08:32 -07:00
|
|
|
}
|
|
|
|
}
|
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-05-29 15:56:45 -07:00
|
|
|
FullscreenToggle.prototype.controlText_ = '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;
|