Enable smooth panning between past/live.

This commit is contained in:
Dermot Duffy
2023-04-09 19:23:34 -07:00
parent b3bb56298a
commit e1d74dc35a
26 changed files with 474 additions and 339 deletions
+7 -4
View File
@@ -31,7 +31,6 @@ export const hideMediaControlsTemporarily = (
};
/**
*
* @param player The Frigate Card Media Player object.
* @param video An underlying video or media player upon which to call play.
*/
@@ -43,10 +42,14 @@ export const playMediaMutingIfNecessary = async (
// and then try again. This works around some browsers that prevent
// auto-play unless the video is muted.
if (video?.play) {
video.play().catch((ev) => {
video.play().catch(async (ev) => {
if (ev.name === 'NotAllowedError' && !player.isMuted()) {
player.mute();
video.play().catch();
await player.mute();
try {
await video.play();
} catch (_) {
// Pass.
}
}
});
}