Skip to content

Commit

Permalink
Fix video OSD not hiding
Browse files Browse the repository at this point in the history
Sometimes (maybe in some browsers) onHideAnimationComplete
is called on btnPause, and the event listener is disconnecting
because it was connected with "once: true".

Don't connect listener with "once: true".
  • Loading branch information
dmitrylyzo committed Jun 3, 2024
1 parent d9c5440 commit 01d7e07
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/controllers/playback/video/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -323,18 +323,14 @@ export default function (view) {
}

function clearHideAnimationEventListeners(elem) {
dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true
});
elem.removeEventListener(transitionEndEventName, onHideAnimationComplete);
}

function onHideAnimationComplete(e) {
const elem = e.target;
if (elem != osdBottomElement) return;
elem.classList.add('hide');
dom.removeEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true
});
elem.removeEventListener(transitionEndEventName, onHideAnimationComplete);
}

const _focus = debounce((focusElement) => focusManager.focus(focusElement), 50);
Expand Down Expand Up @@ -364,9 +360,7 @@ export default function (view) {
clearHideAnimationEventListeners(elem);
elem.classList.add('videoOsdBottom-hidden');

dom.addEventListener(elem, transitionEndEventName, onHideAnimationComplete, {
once: true
});
elem.addEventListener(transitionEndEventName, onHideAnimationComplete);
currentVisibleMenu = null;
toggleSubtitleSync('hide');

Expand Down

0 comments on commit 01d7e07

Please sign in to comment.