Fix live camera preload behavior.

This commit is contained in:
Dermot Duffy
2022-05-08 08:05:33 -07:00
parent f6cdf2f01d
commit cfb5f04438
3 changed files with 20 additions and 7 deletions
+16 -6
View File
@@ -242,13 +242,23 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
| AutoMediaPluginType
| undefined;
if (automedia) {
// If this has changed to preloaded then pause & mute, otherwise play
// and potentially unmute (depending on configuration).
// If this has changed to preloaded (i.e. is now loaded but in the
// background) take the appropriate play/pause/mute/unmute actions.
if (this.preloaded) {
automedia.pause();
automedia.mute();
if (
this.liveConfig?.auto_pause &&
['all', 'unselected'].includes(this.liveConfig.auto_pause)
) {
automedia.pause();
}
if (
this.liveConfig?.auto_mute &&
['all', 'unselected'].includes(this.liveConfig.auto_mute)
) {
automedia.mute();
}
} else {
automedia.play();
this._autoPlayHandler();
this._autoUnmuteHandler();
}
}
@@ -330,7 +340,7 @@ export class FrigateCardLiveCarousel extends FrigateCardMediaCarousel {
/**
* Unmute the media on the loaded slide.
*/
protected _autoUnmuteHandler(): void {
protected _autoUnmuteHandler(): void {
if (
this.liveConfig?.auto_unmute &&
['all', 'selected'].includes(this.liveConfig.auto_unmute)
+3
View File
@@ -79,6 +79,9 @@ export class FrigateCardSurround extends LitElement {
...(this.targetView && { view: this.targetView }),
target: parent,
childIndex: null,
// Don't carry over history of this 'empty' view.
previous: null,
})
.dispatchChangeEvent(this);
}