Update vd.js

This commit is contained in:
Thomas Forgione 2020-10-05 00:02:20 +02:00
parent cff8164bcd
commit 00b68959e5
1 changed files with 20 additions and 5 deletions

View File

@ -277,7 +277,12 @@ const vd = (function() {
}); });
player._oldRequestFullscreen = player.requestFullscreen; player._oldRequestFullscreen = player.requestFullscreen;
player.requestFullscreen = () => { player.requestFullscreen = function() {
var player = document.getElementById(this.id());
if (player === null) {
return;
}
player = typeof player.player === "function" ? player.player() : player.player;
player._oldRequestFullscreen(...arguments); player._oldRequestFullscreen(...arguments);
setTimeout(() => { setTimeout(() => {
if (screen.orientation) { if (screen.orientation) {
@ -287,7 +292,12 @@ const vd = (function() {
}; };
player._oldExitFullscreen = player.exitFullscreen; player._oldExitFullscreen = player.exitFullscreen;
player.exitFullscreen = () => { player.exitFullscreen = function() {
var player = document.getElementById(this.id());
if (player === null) {
return;
}
player = typeof player.player === "function" ? player.player() : player.player;
player._oldExitFullscreen(...arguments); player._oldExitFullscreen(...arguments);
setTimeout(() => { setTimeout(() => {
if (screen.orientation) { if (screen.orientation) {
@ -333,10 +343,15 @@ const vd = (function() {
// F -> toggle fullscreen // F -> toggle fullscreen
case 70: case 70:
e.preventDefault(); e.preventDefault();
if (player.isFullscreen()) { let p = document.getElementById(player.id());
player.exitFullscreen(); if (p === null) {
break;
}
p = typeof p.player === "function" ? p.player() : p.player;
if (p.isFullscreen()) {
p.exitFullscreen();
} else { } else {
player.requestFullscreen(); p.requestFullscreen();
} }
break; break;