Fix for Nest WebRTC cams to not require stream component (#10432)

This commit is contained in:
Allen Porter 2021-10-28 04:47:15 -07:00 committed by GitHub
parent 4b44e197ae
commit 5ef7a37c20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -115,23 +115,18 @@ class HaCameraStream extends LitElement {
// Fallback when unable to fetch stream url // Fallback when unable to fetch stream url
return true; return true;
} }
if ( if (!supportsFeature(this.stateObj!, CAMERA_SUPPORT_STREAM)) {
!isComponentLoaded(this.hass!, "stream") ||
!supportsFeature(this.stateObj!, CAMERA_SUPPORT_STREAM)
) {
// Steaming is not supported by the camera so fallback to MJPEG stream // Steaming is not supported by the camera so fallback to MJPEG stream
return true; return true;
} }
if ( if (
this.stateObj!.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC && this.stateObj!.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC
typeof RTCPeerConnection === "undefined"
) { ) {
// Stream requires WebRTC but browser does not support, so fallback to // Browser support required for WebRTC
// MJPEG stream. return typeof RTCPeerConnection === "undefined";
return true;
} }
// Render stream // Server side stream component required for HLS
return false; return !isComponentLoaded(this.hass!, "stream");
} }
private async _getStreamUrl(): Promise<void> { private async _getStreamUrl(): Promise<void> {