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
return true;
}
if (
!isComponentLoaded(this.hass!, "stream") ||
!supportsFeature(this.stateObj!, CAMERA_SUPPORT_STREAM)
) {
if (!supportsFeature(this.stateObj!, CAMERA_SUPPORT_STREAM)) {
// Steaming is not supported by the camera so fallback to MJPEG stream
return true;
}
if (
this.stateObj!.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC &&
typeof RTCPeerConnection === "undefined"
this.stateObj!.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC
) {
// Stream requires WebRTC but browser does not support, so fallback to
// MJPEG stream.
return true;
// Browser support required for WebRTC
return typeof RTCPeerConnection === "undefined";
}
// Render stream
return false;
// Server side stream component required for HLS
return !isComponentLoaded(this.hass!, "stream");
}
private async _getStreamUrl(): Promise<void> {