Fix browseMediaQueryParameters for clip and snapshot.

This commit is contained in:
Dermot Duffy
2021-10-26 13:20:34 -07:00
parent 8d7e5e9b2e
commit a2d58d59b9
4 changed files with 54 additions and 9 deletions
+27
View File
@@ -24,14 +24,37 @@ export class View {
return this.view == name;
}
/**
* Determine if a view is a gallery.
*/
public isGalleryView(): boolean {
return this.view == 'clips' || this.view == 'snapshots';
}
/**
* Determine if a view is of a piece of media (i.e. not the gallery).
*/
public isMediaView(): boolean {
return !this.isGalleryView();
}
/**
* Determine if a view is related to a clip or clips.
*/
public isClipRelatedView(): boolean {
return ['clip', 'clips'].includes(this.view);
}
/**
* Determine if a view is related to a snapshot or snapshots.
*/
public isSnapshotRelatedView(): boolean {
return ['snapshot', 'snapshots'].includes(this.view);
}
/**
* Get the media item that should be played.
**/
get media(): BrowseMediaSource | undefined {
if (this.target) {
if (this.target.children && this.childIndex !== undefined) {
@@ -42,6 +65,10 @@ export class View {
return undefined;
}
/**
* Dispatch an event to request a view change.
* @param node The element dispatching the event.
*/
public dispatchChangeEvent(node: HTMLElement): void {
node.dispatchEvent(
new CustomEvent<View>('frigate-card:change-view', {