Don't use autoplay logic for snapshots.

This commit is contained in:
Dermot Duffy
2022-01-22 19:38:57 -08:00
parent 34448549b6
commit 20ea8054a7
3 changed files with 28 additions and 9 deletions
+22 -4
View File
@@ -265,6 +265,16 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
super.updated(changedProperties);
}
/**
* Play the media on the selected slide. May be overridden to control when
* autoplay should happen.
*/
protected _autoplayHandler(): void {
if (this.viewerConfig?.autoplay_clip) {
super._autoplayHandler();
}
}
protected _destroyCarousel(): void {
super._destroyCarousel();
@@ -308,9 +318,15 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
}),
]
: []),
MediaAutoPlayPause({
playerSelector: 'frigate-card-ha-hls-player',
}),
// Don't need autoplay/pause for snapshots.
...(this.view?.is('clip')
? [
MediaAutoPlayPause({
playerSelector: 'frigate-card-ha-hls-player',
}),
]
: []),
];
}
@@ -699,7 +715,9 @@ export class FrigateCardViewerCarousel extends FrigateCardMediaCarousel {
// images in media-carousel.ts). Here we need to only call the
// media load handler on a 'real' load.
!lazyLoad ||
(this._plugins['Lazyload'] as LazyloadType | undefined)?.hasLazyloaded(slideIndex)
(this._plugins['Lazyload'] as LazyloadType | undefined)?.hasLazyloaded(
slideIndex,
)
) {
this._mediaLoadedHandler(slideIndex, createMediaShowInfo(e));
}