|
@@ -143,13 +143,22 @@ function setupToolbars() {
|
143
|
143
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Fullscreen_API
|
144
|
144
|
*/
|
145
|
145
|
UI.toggleFullScreen = function() {
|
146
|
|
- // alternative standard method
|
147
|
|
- let isNotFullScreen = !document.fullscreenElement &&
|
148
|
|
- !document.mozFullScreenElement && // current working methods
|
149
|
|
- !document.webkitFullscreenElement &&
|
150
|
|
- !document.msFullscreenElement;
|
|
146
|
+ let isFullScreen = document.fullscreenElement
|
|
147
|
+ || document.mozFullScreenElement // current working methods
|
|
148
|
+ || document.webkitFullscreenElement
|
|
149
|
+ || document.msFullscreenElement;
|
151
|
150
|
|
152
|
|
- if (isNotFullScreen) {
|
|
151
|
+ if (isFullScreen) {
|
|
152
|
+ if (document.exitFullscreen) {
|
|
153
|
+ document.exitFullscreen();
|
|
154
|
+ } else if (document.msExitFullscreen) {
|
|
155
|
+ document.msExitFullscreen();
|
|
156
|
+ } else if (document.mozCancelFullScreen) {
|
|
157
|
+ document.mozCancelFullScreen();
|
|
158
|
+ } else if (document.webkitExitFullscreen) {
|
|
159
|
+ document.webkitExitFullscreen();
|
|
160
|
+ }
|
|
161
|
+ } else {
|
153
|
162
|
if (document.documentElement.requestFullscreen) {
|
154
|
163
|
document.documentElement.requestFullscreen();
|
155
|
164
|
} else if (document.documentElement.msRequestFullscreen) {
|
|
@@ -160,16 +169,6 @@ UI.toggleFullScreen = function() {
|
160
|
169
|
document.documentElement
|
161
|
170
|
.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
|
162
|
171
|
}
|
163
|
|
- } else {
|
164
|
|
- if (document.exitFullscreen) {
|
165
|
|
- document.exitFullscreen();
|
166
|
|
- } else if (document.msExitFullscreen) {
|
167
|
|
- document.msExitFullscreen();
|
168
|
|
- } else if (document.mozCancelFullScreen) {
|
169
|
|
- document.mozCancelFullScreen();
|
170
|
|
- } else if (document.webkitExitFullscreen) {
|
171
|
|
- document.webkitExitFullscreen();
|
172
|
|
- }
|
173
|
172
|
}
|
174
|
173
|
};
|
175
|
174
|
|
|
@@ -380,7 +379,7 @@ function registerListeners() {
|
380
|
379
|
}
|
381
|
380
|
});
|
382
|
381
|
|
383
|
|
- UI.addListener(UIEvents.FULLSCREEN_TOGGLE, UI.toggleFullScreen);
|
|
382
|
+ UI.addListener(UIEvents.TOGGLE_FULLSCREEN, UI.toggleFullScreen);
|
384
|
383
|
|
385
|
384
|
UI.addListener(UIEvents.TOGGLE_CHAT, UI.toggleChat);
|
386
|
385
|
|
|
@@ -415,7 +414,16 @@ function bindEvents() {
|
415
|
414
|
// Resize and reposition videos in full screen mode.
|
416
|
415
|
$(document).on(
|
417
|
416
|
'webkitfullscreenchange mozfullscreenchange fullscreenchange',
|
418
|
|
- onResize
|
|
417
|
+ () => {
|
|
418
|
+ let isFullScreen = document.fullscreenElement
|
|
419
|
+ || document.mozFullScreenElement // current working methods
|
|
420
|
+ || document.webkitFullscreenElement
|
|
421
|
+ || document.msFullscreenElement;
|
|
422
|
+
|
|
423
|
+ eventEmitter.emit(UIEvents.FULLSCREEN_TOGGLED, isFullScreen);
|
|
424
|
+
|
|
425
|
+ onResize();
|
|
426
|
+ }
|
419
|
427
|
);
|
420
|
428
|
|
421
|
429
|
$(window).resize(onResize);
|