From 5b4ac6b6ecd824ecf2c299fc055d4b931e70d731 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 1 Dec 2022 10:25:36 +0100 Subject: [PATCH] MOBILE-4081 h5p: Fix full screen in Android --- src/core/features/h5p/assets/js/h5p.js | 15 +++++++++------ src/core/features/h5p/assets/readme_moodle.txt | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/core/features/h5p/assets/js/h5p.js b/src/core/features/h5p/assets/js/h5p.js index 7cb831751..bab4edb3f 100644 --- a/src/core/features/h5p/assets/js/h5p.js +++ b/src/core/features/h5p/assets/js/h5p.js @@ -37,13 +37,16 @@ if (document.documentElement.requestFullScreen) { H5P.fullScreenBrowserPrefix = ''; } else if (document.documentElement.webkitRequestFullScreen) { - H5P.safariBrowser = navigator.userAgent.match(/version\/([.\d]+)/i); - H5P.safariBrowser = (H5P.safariBrowser === null ? 0 : parseInt(H5P.safariBrowser[1])); + // This code has been changed to allow full screen in Moodle app. + H5P.fullScreenBrowserPrefix = 'webkit'; + H5P.safariBrowser = 0; + // H5P.safariBrowser = navigator.userAgent.match(/version\/([.\d]+)/i); + // H5P.safariBrowser = (H5P.safariBrowser === null ? 0 : parseInt(H5P.safariBrowser[1])); - // Do not allow fullscreen for safari < 7. - if (H5P.safariBrowser === 0 || H5P.safariBrowser > 6) { - H5P.fullScreenBrowserPrefix = 'webkit'; - } + // // Do not allow fullscreen for safari < 7. + // if (H5P.safariBrowser === 0 || H5P.safariBrowser > 6) { + // H5P.fullScreenBrowserPrefix = 'webkit'; + // } } else if (document.documentElement.mozRequestFullScreen) { H5P.fullScreenBrowserPrefix = 'moz'; diff --git a/src/core/features/h5p/assets/readme_moodle.txt b/src/core/features/h5p/assets/readme_moodle.txt index 7a5805bae..069a7f74f 100644 --- a/src/core/features/h5p/assets/readme_moodle.txt +++ b/src/core/features/h5p/assets/readme_moodle.txt @@ -4,3 +4,4 @@ H5P library Changes: 1. The h5p.js file has been modified to make fullscreen work in the Moodle app. In line 34, the code inside the condition document.documentElement.webkitRequestFullScreen has changed, the original code has been commented. +2. The h5p.js file has been modified to simulate a fake full screen in iOS. The H5P file now sends post messages to the app, and also listens to messages sent by the app to enter/exit full screen.