Allow ExoPlayer only from more-info-camera (#6974)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
uvjustin 2020-09-15 06:26:26 +08:00 committed by GitHub
parent 858196ab53
commit 4392d78ff6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 1 deletions

View File

@ -32,6 +32,9 @@ class HaCameraStream extends LitElement {
@property({ type: Boolean, attribute: "muted" })
public muted = false;
@property({ type: Boolean, attribute: "allow-exoplayer" })
public allowExoPlayer = false;
// We keep track if we should force MJPEG with a string
// that way it automatically resets if we change entity.
@internalProperty() private _forceMJPEG?: string;
@ -61,6 +64,7 @@ class HaCameraStream extends LitElement {
<ha-hls-player
autoplay
playsinline
.allowExoPlayer=${this.allowExoPlayer}
.muted=${this.muted}
.controls=${this.controls}
.hass=${this.hass}

View File

@ -35,6 +35,9 @@ class HaHLSPlayer extends LitElement {
@property({ type: Boolean, attribute: "playsinline" })
public playsInline = false;
@property({ type: Boolean, attribute: "allow-exoplayer" })
public allowExoPlayer = false;
@query("video") private _videoEl!: HTMLVideoElement;
@internalProperty() private _attached = false;
@ -91,7 +94,7 @@ class HaHLSPlayer extends LitElement {
}
private async _getUseExoPlayer(): Promise<boolean> {
if (!this.hass!.auth.external) {
if (!this.hass!.auth.external || !this.allowExoPlayer) {
return false;
}
const externalConfig = await getExternalConfig(this.hass!.auth.external);

View File

@ -48,6 +48,7 @@ class MoreInfoCamera extends LitElement {
<ha-camera-stream
.hass=${this.hass}
.stateObj=${this.stateObj}
allow-exoplayer
controls
></ha-camera-stream>
${this._cameraPrefs