Fix controls and seeking bugs.

This commit is contained in:
Dermot Duffy
2024-04-14 19:47:44 -07:00
parent e13a7bed6b
commit b4ed40e6c7
3 changed files with 30 additions and 0 deletions
+11
View File
@@ -44,6 +44,17 @@ export const hideMediaControlsTemporarily = (
setControlsOnVideo(video, false);
video._controlsHideTimer ??= new Timer();
video._controlsOriginalValue = oldValue;
// LitElement may change the src attribute of the video element during
// rendering, so we need to ensure that the controls are reset on the 'old'
// video. See:
// https://github.com/dermotduffy/frigate-hass-card/issues/1310
const resetIfReloaded = () => {
setControlsOnVideo(video, oldValue);
video.removeEventListener('loadstart', resetIfReloaded);
};
video.addEventListener('loadstart', resetIfReloaded);
video._controlsHideTimer.start(seconds, () => {
setControlsOnVideo(video, oldValue);
});