mirror of
https://github.com/home-assistant/frontend.git
synced 2025-11-11 03:51:07 +00:00
Add fit mode support to picture glance card and picture entity card (#25005)
Co-authored-by: karwosts <karwosts@gmail.com>
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import type { PropertyValues, TemplateResult } from "lit";
|
||||
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
|
||||
import type { PropertyValues, TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
import { styleMap } from "lit/directives/style-map";
|
||||
import { fireEvent } from "../common/dom/fire_event";
|
||||
import {
|
||||
addWebRtcCandidate,
|
||||
@@ -26,6 +27,10 @@ class HaWebRtcPlayer extends LitElement {
|
||||
|
||||
@property() public entityid?: string;
|
||||
|
||||
@property({ attribute: false }) public aspectRatio?: number;
|
||||
|
||||
@property({ attribute: false }) public fitMode?: "cover" | "contain" | "fill";
|
||||
|
||||
@property({ type: Boolean, attribute: "controls" })
|
||||
public controls = false;
|
||||
|
||||
@@ -69,6 +74,11 @@ class HaWebRtcPlayer extends LitElement {
|
||||
?controls=${this.controls}
|
||||
poster=${ifDefined(this.posterUrl)}
|
||||
@loadeddata=${this._loadedData}
|
||||
style=${styleMap({
|
||||
height: this.aspectRatio == null ? "100%" : "auto",
|
||||
aspectRatio: this.aspectRatio,
|
||||
objectFit: this.fitMode,
|
||||
})}
|
||||
></video>
|
||||
`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user