mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-09 02:16:35 +00:00
Fix HLS player cleanup (null access to removeAttribute
) (#11074)
This commit is contained in:
parent
5261d583a8
commit
595e13ecac
@ -98,7 +98,6 @@ class HaHLSPlayer extends LitElement {
|
|||||||
private async _startHls(): Promise<void> {
|
private async _startHls(): Promise<void> {
|
||||||
this._error = undefined;
|
this._error = undefined;
|
||||||
|
|
||||||
const videoEl = this._videoEl;
|
|
||||||
const useExoPlayerPromise = this._getUseExoPlayer();
|
const useExoPlayerPromise = this._getUseExoPlayer();
|
||||||
const masterPlaylistPromise = fetch(this.url);
|
const masterPlaylistPromise = fetch(this.url);
|
||||||
|
|
||||||
@ -113,7 +112,7 @@ class HaHLSPlayer extends LitElement {
|
|||||||
|
|
||||||
if (!hlsSupported) {
|
if (!hlsSupported) {
|
||||||
hlsSupported =
|
hlsSupported =
|
||||||
videoEl.canPlayType("application/vnd.apple.mpegurl") !== "";
|
this._videoEl.canPlayType("application/vnd.apple.mpegurl") !== "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hlsSupported) {
|
if (!hlsSupported) {
|
||||||
@ -151,9 +150,9 @@ class HaHLSPlayer extends LitElement {
|
|||||||
if (useExoPlayer && match !== null && match[1] !== undefined) {
|
if (useExoPlayer && match !== null && match[1] !== undefined) {
|
||||||
this._renderHLSExoPlayer(playlist_url);
|
this._renderHLSExoPlayer(playlist_url);
|
||||||
} else if (Hls.isSupported()) {
|
} else if (Hls.isSupported()) {
|
||||||
this._renderHLSPolyfill(videoEl, Hls, playlist_url);
|
this._renderHLSPolyfill(this._videoEl, Hls, playlist_url);
|
||||||
} else {
|
} else {
|
||||||
this._renderHLSNative(videoEl, playlist_url);
|
this._renderHLSNative(this._videoEl, playlist_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -261,9 +260,10 @@ class HaHLSPlayer extends LitElement {
|
|||||||
this.hass!.auth.external!.fireMessage({ type: "exoplayer/stop" });
|
this.hass!.auth.external!.fireMessage({ type: "exoplayer/stop" });
|
||||||
this._exoPlayer = false;
|
this._exoPlayer = false;
|
||||||
}
|
}
|
||||||
const videoEl = this._videoEl;
|
if (this._videoEl) {
|
||||||
videoEl.removeAttribute("src");
|
this._videoEl.removeAttribute("src");
|
||||||
videoEl.load();
|
this._videoEl.load();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static get styles(): CSSResultGroup {
|
static get styles(): CSSResultGroup {
|
||||||
|
@ -136,9 +136,8 @@ class HaWebRtcPlayer extends LitElement {
|
|||||||
this._remoteStream = undefined;
|
this._remoteStream = undefined;
|
||||||
}
|
}
|
||||||
if (this._videoEl) {
|
if (this._videoEl) {
|
||||||
const videoEl = this._videoEl;
|
this._videoEl.removeAttribute("src");
|
||||||
videoEl.removeAttribute("src");
|
this._videoEl.load();
|
||||||
videoEl.load();
|
|
||||||
}
|
}
|
||||||
if (this._peerConnection) {
|
if (this._peerConnection) {
|
||||||
this._peerConnection.close();
|
this._peerConnection.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user