Initial draft of recordings support.

This commit is contained in:
Dermot Duffy
2022-06-04 11:04:38 -07:00
parent 2e80bdad0b
commit 7ebada9aa5
26 changed files with 1016 additions and 181 deletions
+34 -1
View File
@@ -612,6 +612,13 @@ export class FrigateCardLiveProvider extends LitElement {
this._providerRef.value?.unmute();
}
/**
* Seek the video.
*/
public seek(seconds: number): void {
this._providerRef.value?.seek(seconds);
}
protected _getResolvedProvider(): LiveProvider {
if (this.cameraConfig?.live_provider === 'auto') {
if (
@@ -711,6 +718,13 @@ export class FrigateCardLiveFrigate extends LitElement {
this._playerRef.value?.unmute();
}
/**
* Seek the video.
*/
public seek(seconds: number): void {
this._playerRef.value?.seek(seconds);
}
/**
* Master render method.
* @returns A rendered template.
@@ -810,6 +824,16 @@ export class FrigateCardLiveWebRTCCard extends LitElement {
}
}
/**
* Seek the video.
*/
public seek(seconds: number): void {
const player = this._getPlayer();
if (player) {
player.currentTime = seconds;
}
}
/**
* Get the underlying video player.
* @returns The player or `null` if not found.
@@ -867,8 +891,9 @@ export class FrigateCardLiveWebRTCCard extends LitElement {
return dispatchErrorMessageEvent(
this,
e instanceof FrigateCardError
? (e as FrigateCardError).message
? e.message
: localize('error.webrtc_card_reported_error') + ': ' + (e as Error).message,
(e as FrigateCardError).context
);
}
return html`${webrtcElement}`;
@@ -964,6 +989,14 @@ export class FrigateCardLiveJSMPEG extends LitElement {
}
}
/**
* Seek the video (unsupported).
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public seek(_seconds: number): void {
// JSMPEG does not support seeking.
}
/**
* Get a signed player URL.
* @returns A URL or null.