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
+1
View File
@@ -138,6 +138,7 @@ export class FrigateCardSurround extends LitElement {
...(media.getCameraID() && { camera: media.getCameraID() }),
})
.removeContext('timeline')
.removeContext('mediaViewer')
// Send the view change from the source of the tap event, so
// the view change will be caught by the handler above (to
// close the drawer).
+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);
});