1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-10 23:30:03 +02:00

fix: fix fullscreen detection when player is nested within document fullscreen (#5912)

This commit is contained in:
Richard Bushell 2019-04-11 18:57:19 +01:00 committed by Pat O'Neill
parent cd073417ed
commit 22d0514257
2 changed files with 9 additions and 14 deletions

View File

@ -22,7 +22,8 @@ const apiMap = [
'fullscreenElement', 'fullscreenElement',
'fullscreenEnabled', 'fullscreenEnabled',
'fullscreenchange', 'fullscreenchange',
'fullscreenerror' 'fullscreenerror',
'fullscreen'
], ],
// WebKit // WebKit
[ [
@ -31,16 +32,8 @@ const apiMap = [
'webkitFullscreenElement', 'webkitFullscreenElement',
'webkitFullscreenEnabled', 'webkitFullscreenEnabled',
'webkitfullscreenchange', 'webkitfullscreenchange',
'webkitfullscreenerror' 'webkitfullscreenerror',
], '-webkit-full-screen'
// Old WebKit (Safari 5.1)
[
'webkitRequestFullScreen',
'webkitCancelFullScreen',
'webkitCurrentFullScreenElement',
'webkitCancelFullScreen',
'webkitfullscreenchange',
'webkitfullscreenerror'
], ],
// Mozilla // Mozilla
[ [
@ -49,7 +42,8 @@ const apiMap = [
'mozFullScreenElement', 'mozFullScreenElement',
'mozFullScreenEnabled', 'mozFullScreenEnabled',
'mozfullscreenchange', 'mozfullscreenchange',
'mozfullscreenerror' 'mozfullscreenerror',
'-moz-full-screen'
], ],
// Microsoft // Microsoft
[ [
@ -58,7 +52,8 @@ const apiMap = [
'msFullscreenElement', 'msFullscreenElement',
'msFullscreenEnabled', 'msFullscreenEnabled',
'MSFullscreenChange', 'MSFullscreenChange',
'MSFullscreenError' 'MSFullscreenError',
'-ms-fullscreen'
] ]
]; ];

View File

@ -1989,7 +1989,7 @@ class Player extends Component {
documentFullscreenChange_(e) { documentFullscreenChange_(e) {
const fsApi = FullscreenApi; const fsApi = FullscreenApi;
this.isFullscreen(document[fsApi.fullscreenElement] === this.el()); this.isFullscreen(document[fsApi.fullscreenElement] === this.el() || this.el().matches(':' + fsApi.fullscreen));
// If cancelling fullscreen, remove event listener. // If cancelling fullscreen, remove event listener.
if (this.isFullscreen() === false) { if (this.isFullscreen() === false) {