From 4d020dbf31cca74ed1004d0cc9b7b162b07490d3 Mon Sep 17 00:00:00 2001 From: "yair.ansbacher" Date: Sun, 18 Oct 2020 19:26:00 +0300 Subject: [PATCH 1/2] another solution --- src/fullscreen/fullscreen-controller.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fullscreen/fullscreen-controller.js b/src/fullscreen/fullscreen-controller.js index f3e861902..f1ada532a 100644 --- a/src/fullscreen/fullscreen-controller.js +++ b/src/fullscreen/fullscreen-controller.js @@ -49,7 +49,10 @@ class FullscreenController { document.mozFullScreenElement || document.msFullscreenElement || // $FlowFixMe for ios mobile - (this._player.env.os.name === 'iOS' && !!videoElement && !!videoElement.webkitDisplayingFullscreen) + (this._player.env.os.name === 'iOS' && + !!videoElement && + !!videoElement.webkitDisplayingFullscreen && + (!videoElement.webkitPresentationMode || videoElement.webkitPresentationMode === 'fullscreen')) ); } @@ -87,7 +90,13 @@ class FullscreenController { } else { const videoElement: ?HTMLVideoElement = this._player.getVideoElement(); if (videoElement && typeof videoElement.webkitEnterFullScreen === 'function') { - videoElement.webkitEnterFullScreen(); + if (this._player.isInPictureInPicture()) { + // iOS < 13 (iPad) has an issue to enter to full screen from PiP + setTimeout(() => videoElement.webkitEnterFullScreen(), 1000); + this._player.exitPictureInPicture(); + } else { + videoElement.webkitEnterFullScreen(); + } } } } else { From 4a1dc20f83a1ad84b598c1fce818ba9baf15a27f Mon Sep 17 00:00:00 2001 From: "yair.ansbacher" Date: Mon, 19 Oct 2020 10:50:30 +0300 Subject: [PATCH 2/2] move 1000 to const --- src/fullscreen/fullscreen-controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/fullscreen/fullscreen-controller.js b/src/fullscreen/fullscreen-controller.js index f1ada532a..5a8914d75 100644 --- a/src/fullscreen/fullscreen-controller.js +++ b/src/fullscreen/fullscreen-controller.js @@ -11,6 +11,8 @@ import * as Utils from '../utils/util'; */ const IN_BROWSER_FULLSCREEN: string = 'playkit-in-browser-fullscreen-mode'; +const EXIT_PIP_TIMEOUT: number = 1000; + /** * @class FullscreenController * @param {Player} player - The player. @@ -92,7 +94,7 @@ class FullscreenController { if (videoElement && typeof videoElement.webkitEnterFullScreen === 'function') { if (this._player.isInPictureInPicture()) { // iOS < 13 (iPad) has an issue to enter to full screen from PiP - setTimeout(() => videoElement.webkitEnterFullScreen(), 1000); + setTimeout(() => videoElement.webkitEnterFullScreen(), EXIT_PIP_TIMEOUT); this._player.exitPictureInPicture(); } else { videoElement.webkitEnterFullScreen();