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
+8 -7
View File
@@ -9,16 +9,17 @@
// available as compilation time.
// ====================================================================
import { css, CSSResultGroup, html, unsafeCSS, TemplateResult } from 'lit';
import { css, CSSResultGroup, html, TemplateResult, unsafeCSS } from 'lit';
import { customElement } from 'lit/decorators.js';
import { query } from 'lit/decorators/query.js';
import { dispatchErrorMessageEvent } from '../components/message.js';
import liveHAComponentsStyle from '../scss/live-ha-components.scss';
import { FrigateCardMediaPlayer } from '../types.js';
import { dispatchMediaLoadedEvent } from '../utils/media-info.js';
import {
hideMediaControlsTemporarily,
MEDIA_LOAD_CONTROLS_HIDE_SECONDS,
MEDIA_LOAD_CONTROLS_HIDE_SECONDS
} from '../utils/media.js';
import liveHAComponentsStyle from '../scss/live-ha-components.scss';
customElements.whenDefined('ha-web-rtc-player').then(() => {
@customElement('frigate-card-ha-web-rtc-player')
@@ -36,11 +37,11 @@ customElements.whenDefined('ha-web-rtc-player').then(() => {
return this._video?.play();
}
public pause(): void {
public async pause(): Promise<void> {
this._video?.pause();
}
public mute(): void {
public async mute(): Promise<void> {
// The muted property is only for the initial muted state. Must explicitly
// set the muted on the video player to make the change dynamic.
if (this._video) {
@@ -48,7 +49,7 @@ customElements.whenDefined('ha-web-rtc-player').then(() => {
}
}
public unmute(): void {
public async unmute(): Promise<void> {
// See note in mute().
if (this._video) {
this._video.muted = false;
@@ -59,7 +60,7 @@ customElements.whenDefined('ha-web-rtc-player').then(() => {
return this._video?.muted ?? true;
}
public seek(seconds: number): void {
public async seek(seconds: number): Promise<void> {
if (this._video) {
this._video.currentTime = seconds;
}