Clean up seek handler.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
// TODO: Performance of video scanning (pause/play?)
|
// TODO: Video scanning not select other camera?
|
||||||
|
// TODO: Drag from live results in different cameras being shown in timeline in media viewer?
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CSSResultGroup,
|
CSSResultGroup,
|
||||||
|
|||||||
@@ -541,24 +541,24 @@ export class FrigateCardViewerCarousel extends LitElement {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const selectedMedia = this._media[this.selected];
|
const selectedMedia = this._media[this.selected];
|
||||||
if (!selectedMedia) {
|
const player = this._getPlayer();
|
||||||
|
if (!selectedMedia || !player) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const seekTimeInMedia = selectedMedia.includesTime(seek);
|
const seekTimeInMedia = selectedMedia.includesTime(seek);
|
||||||
|
|
||||||
setOrRemoveAttribute(this, !seekTimeInMedia, 'unseekable');
|
setOrRemoveAttribute(this, !seekTimeInMedia, 'unseekable');
|
||||||
if (!seekTimeInMedia) {
|
if (!seekTimeInMedia && !player.isPaused()) {
|
||||||
this._getPlayer()?.pause();
|
player.pause();
|
||||||
} else {
|
} else if (seekTimeInMedia && player.isPaused()) {
|
||||||
this._getPlayer()?.play();
|
player.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
const seekTime =
|
const seekTime =
|
||||||
(await this.cameraManager?.getMediaSeekTime(this.hass, selectedMedia, seek)) ??
|
(await this.cameraManager?.getMediaSeekTime(this.hass, selectedMedia, seek)) ??
|
||||||
null;
|
null;
|
||||||
const player = this._getPlayer();
|
|
||||||
if (player && seekTime !== null) {
|
if (seekTime !== null) {
|
||||||
player.seek(seekTime);
|
player.seek(seekTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user