Merge pull request #3493 from dpalou/MOBILE-4081

MOBILE-4081 h5p: Fix full screen in Android
main
Pau Ferrer Ocaña 2022-12-01 10:34:35 +01:00 committed by GitHub
commit de29903320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 6 deletions

View File

@ -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';

View File

@ -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.