fix: Fix certain webrtc streams that were not loading correctly (#1766)
This commit is contained in:
@@ -12,6 +12,7 @@
|
|||||||
import { css, CSSResultGroup, html, TemplateResult, unsafeCSS } from 'lit';
|
import { css, CSSResultGroup, html, TemplateResult, unsafeCSS } from 'lit';
|
||||||
import { customElement } from 'lit/decorators.js';
|
import { customElement } from 'lit/decorators.js';
|
||||||
import { query } from 'lit/decorators/query.js';
|
import { query } from 'lit/decorators/query.js';
|
||||||
|
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||||
import { dispatchLiveErrorEvent } from '../components-lib/live/utils/dispatch-live-error.js';
|
import { dispatchLiveErrorEvent } from '../components-lib/live/utils/dispatch-live-error.js';
|
||||||
import { renderMessage } from '../components/message.js';
|
import { renderMessage } from '../components/message.js';
|
||||||
import liveHAComponentsStyle from '../scss/live-ha-components.scss';
|
import liveHAComponentsStyle from '../scss/live-ha-components.scss';
|
||||||
@@ -111,6 +112,7 @@ customElements.whenDefined('ha-web-rtc-player').then(() => {
|
|||||||
.muted=${this.muted}
|
.muted=${this.muted}
|
||||||
?playsinline=${this.playsInline}
|
?playsinline=${this.playsInline}
|
||||||
?controls=${this.controls}
|
?controls=${this.controls}
|
||||||
|
poster=${ifDefined(this.posterUrl)}
|
||||||
@loadedmetadata=${() => {
|
@loadedmetadata=${() => {
|
||||||
if (this.controls) {
|
if (this.controls) {
|
||||||
hideMediaControlsTemporarily(
|
hideMediaControlsTemporarily(
|
||||||
@@ -119,7 +121,16 @@ customElements.whenDefined('ha-web-rtc-player').then(() => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
@loadeddata=${(ev) => {
|
@loadeddata=${(ev) => this._loadedDataHandler(ev)}
|
||||||
|
@volumechange=${() => dispatchMediaVolumeChangeEvent(this)}
|
||||||
|
@play=${() => dispatchMediaPlayEvent(this)}
|
||||||
|
@pause=${() => dispatchMediaPauseEvent(this)}
|
||||||
|
></video>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _loadedDataHandler(ev: Event) {
|
||||||
|
super._loadedData();
|
||||||
dispatchMediaLoadedEvent(this, ev, {
|
dispatchMediaLoadedEvent(this, ev, {
|
||||||
player: this,
|
player: this,
|
||||||
capabilities: {
|
capabilities: {
|
||||||
@@ -128,12 +139,6 @@ customElements.whenDefined('ha-web-rtc-player').then(() => {
|
|||||||
},
|
},
|
||||||
technology: ['webrtc'],
|
technology: ['webrtc'],
|
||||||
});
|
});
|
||||||
}}
|
|
||||||
@volumechange=${() => dispatchMediaVolumeChangeEvent(this)}
|
|
||||||
@play=${() => dispatchMediaPlayEvent(this)}
|
|
||||||
@pause=${() => dispatchMediaPauseEvent(this)}
|
|
||||||
></video>
|
|
||||||
`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
|||||||
Reference in New Issue
Block a user