Add delay on play/pause to prevent hiccup when entering fullscreen

Resolves: #589
This commit is contained in:
Andreas B 2020-02-09 16:26:55 +01:00
parent 0d0f210c6a
commit 1225800e7e

View File

@ -1230,6 +1230,9 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
shell.disableFullscreen(); shell.disableFullscreen();
}); });
if(playerPauseClickTimeout) {
clearTimeout(playerPauseClickTimeout);
}
var player = currentPlayer; var player = currentPlayer;
view.removeEventListener("viewbeforehide", onViewHideStopPlayback); view.removeEventListener("viewbeforehide", onViewHideStopPlayback);
releaseCurrentPlayer(); releaseCurrentPlayer();
@ -1369,6 +1372,7 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
destroySubtitleSync(); destroySubtitleSync();
}); });
var lastPointerDown = 0; var lastPointerDown = 0;
let playerPauseClickTimeout;
dom.addEventListener(view, window.PointerEvent ? "pointerdown" : "click", function (e) { dom.addEventListener(view, window.PointerEvent ? "pointerdown" : "click", function (e) {
if (dom.parentWithClass(e.target, ["videoOsdBottom", "upNextContainer"])) { if (dom.parentWithClass(e.target, ["videoOsdBottom", "upNextContainer"])) {
return void showOsd(); return void showOsd();
@ -1388,8 +1392,16 @@ define(["playbackManager", "dom", "inputManager", "datetime", "itemHelper", "med
case "mouse": case "mouse":
if (!e.button) { if (!e.button) {
playbackManager.playPause(currentPlayer); if(playerPauseClickTimeout){
showOsd(); clearTimeout(playerPauseClickTimeout);
playerPauseClickTimeout = 0;
} else {
playerPauseClickTimeout = setTimeout(() => {
playbackManager.playPause(currentPlayer);
showOsd();
playerPauseClickTimeout = 0;
}, 300);
}
} }
break; break;