/**
* Toggles the fullscreen mode.
*/
toggleFullscreen() {
if (document.webkitIsFullScreen) {
this._exitFullscreen();
} else {
this._activateFullscreen();
}
}
/**
* Activate Full Screen Mode.
*/
private _activateFullscreen() {
let fullscreenElement = document.documentElement;
if (fullscreenElement.requestFullscreen) {
fullscreenElement.requestFullscreen();
} else if (fullscreenElement.mozRequestFullScreen) {
/* Firefox */
fullscreenElement.mozRequestFullScreen();
} else if (fullscreenElement.webkitRequestFullscreen) {
/* Chrome, Safari and Opera */
fullscreenElement.webkitRequestFullscreen();
} else if (fullscreenElement.msRequestFullscreen) {
/* IE/Edge */
fullscreenElement.msRequestFullscreen();
}
}
/**
* Exits Full Screen Mode.
*/
private _exitFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.mozCancelFullScreen) {
/* Firefox */
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
/* Chrome, Safari and Opera */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
/* IE/Edge */
document.msExitFullscreen();
}
}