diff --git a/src/components/ha-web-rtc-player.ts b/src/components/ha-web-rtc-player.ts index 91f2c71cd2e2..a15673ccea09 100644 --- a/src/components/ha-web-rtc-player.ts +++ b/src/components/ha-web-rtc-player.ts @@ -54,7 +54,7 @@ class HaWebRtcPlayer extends LitElement { private _sessionId?: string; - private _candidatesList: string[] = []; + private _candidatesList: RTCIceCandidate[] = []; protected override render(): TemplateResult { if (this._error) { @@ -267,7 +267,7 @@ class HaWebRtcPlayer extends LitElement { try { await this._peerConnection?.addIceCandidate( - new RTCIceCandidate({ candidate: event.candidate, sdpMid: "0" }) + new RTCIceCandidate(event.candidate) ); } catch (err: any) { // eslint-disable-next-line no-console @@ -285,17 +285,21 @@ class HaWebRtcPlayer extends LitElement { return; } - this._logEvent("local ice candidate", event.candidate?.candidate); + this._logEvent( + "local ice candidate", + event.candidate?.candidate, + event.candidate?.sdpMLineIndex + ); if (this._sessionId) { addWebRtcCandidate( this.hass, this.entityid, this._sessionId, - event.candidate?.candidate + event.candidate ); } else { - this._candidatesList.push(event.candidate?.candidate); + this._candidatesList.push(event.candidate); } }; diff --git a/src/data/camera.ts b/src/data/camera.ts index 8c3bfe537f1d..6420293bd899 100644 --- a/src/data/camera.ts +++ b/src/data/camera.ts @@ -59,7 +59,7 @@ export interface WebRtcAnswer { export interface WebRtcCandidate { type: "candidate"; - candidate: string; + candidate: RTCIceCandidate; } export interface WebRtcError { @@ -139,13 +139,13 @@ export const addWebRtcCandidate = ( hass: HomeAssistant, entity_id: string, session_id: string, - candidate: string + candidate: RTCIceCandidate ) => hass.callWS({ type: "camera/webrtc/candidate", entity_id, session_id, - candidate, + candidate: candidate, }); export const fetchCameraPrefs = (hass: HomeAssistant, entityId: string) =>