0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-03-11 02:12:21 -05:00

Refined video controls hidden behavior

refs https://github.com/TryGhost/Team/issues/1229
This commit is contained in:
Rishabh 2021-12-14 22:39:54 +05:30
parent e574a8f2b3
commit 182899150f

View file

@ -14,6 +14,7 @@
const currentTimeContainer = videoElementContainer.querySelector('.kg-video-current-time');
const largePlayIcon = videoElementContainer.querySelector('.kg-video-large-play-icon');
const videoOverlay = videoElementContainer.querySelector('.kg-video-overlay');
let hasStartedPlayback = false;
let playbackRates = [{
rate: 0.75,
label: '0.7×'
@ -110,7 +111,7 @@
videoElementContainer.onmouseleave = () => {
const isPlaying = !!(videoEl.currentTime > 0 && !videoEl.paused && !videoEl.ended && videoEl.readyState > 2);
if (isPlaying) {
if (isPlaying || hasStartedPlayback) {
videoPlayerContainer.classList.add("kg-video-hide-animated");
}
}
@ -127,6 +128,7 @@
});
videoEl.onplay = () => {
hasStartedPlayback = true;
largePlayIcon.classList.add("kg-video-hide-animated");
videoOverlay.classList.add("kg-video-hide-animated");
playIconContainer.classList.add("kg-video-hide");