mirror of
https://github.com/home-assistant/frontend
synced 2024-09-12 05:34:56 +02: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> {
|
||||
this._error = undefined;
|
||||
|
||||
const videoEl = this._videoEl;
|
||||
const useExoPlayerPromise = this._getUseExoPlayer();
|
||||
const masterPlaylistPromise = fetch(this.url);
|
||||
|
||||
@ -113,7 +112,7 @@ class HaHLSPlayer extends LitElement {
|
||||
|
||||
if (!hlsSupported) {
|
||||
hlsSupported =
|
||||
videoEl.canPlayType("application/vnd.apple.mpegurl") !== "";
|
||||
this._videoEl.canPlayType("application/vnd.apple.mpegurl") !== "";
|
||||
}
|
||||
|
||||
if (!hlsSupported) {
|
||||
@ -151,9 +150,9 @@ class HaHLSPlayer extends LitElement {
|
||||
if (useExoPlayer && match !== null && match[1] !== undefined) {
|
||||
this._renderHLSExoPlayer(playlist_url);
|
||||
} else if (Hls.isSupported()) {
|
||||
this._renderHLSPolyfill(videoEl, Hls, playlist_url);
|
||||
this._renderHLSPolyfill(this._videoEl, Hls, playlist_url);
|
||||
} 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._exoPlayer = false;
|
||||
}
|
||||
const videoEl = this._videoEl;
|
||||
videoEl.removeAttribute("src");
|
||||
videoEl.load();
|
||||
if (this._videoEl) {
|
||||
this._videoEl.removeAttribute("src");
|
||||
this._videoEl.load();
|
||||
}
|
||||
}
|
||||
|
||||
static get styles(): CSSResultGroup {
|
||||
|
@ -136,9 +136,8 @@ class HaWebRtcPlayer extends LitElement {
|
||||
this._remoteStream = undefined;
|
||||
}
|
||||
if (this._videoEl) {
|
||||
const videoEl = this._videoEl;
|
||||
videoEl.removeAttribute("src");
|
||||
videoEl.load();
|
||||
this._videoEl.removeAttribute("src");
|
||||
this._videoEl.load();
|
||||
}
|
||||
if (this._peerConnection) {
|
||||
this._peerConnection.close();
|
||||
|
Loading…
Reference in New Issue
Block a user