webrtc-android
webrtc-android copied to clipboard
Converting Android SessionDescription to javascript RTCSessionDescription error
When trying to send the Android SessionDescription object to a web client RTCSessionDescription I get an error
Error setting remote description DOMException: Failed to execute 'setRemoteDescription' on 'RTCPeerConnection': Failed to parse SessionDescription. Expect line: v=
I also got an error saying that the type enum was incorrect and ANSWER didnt exist, I had to toLowerCase on the type in the web client for that error to go away
When sending the SessionDescription from android I convert it to json with gson like I have seen in a lot of examples
....
json.put("sdp", gson.toJson(desc))
....
Then on the web side I just put that value into the description
peerConnection.setRemoteDescription(new RTCSessionDescription(sdp))
This is what the description data looks like
v=0
o=- 4842731917606126277 2 IN IP4 127.0.0.1
s=-
t=0 0
a=extmap-allow-mixed
a=msid-semantic: WMS
These two types dont seem compatible, what are you suppose to do?
Just after posting this I found out how to fix it
for anyone else coming across this issue, you cannot just pass in the whole object like this
peerConnection.setRemoteDescription(new RTCSessionDescription(sdp))
or
peerConnection.setRemoteDescription(sdp)
Instead you have to put the type and description in explicitly
peerConnection.setRemoteDescription(new RTCSessionDescription({
type: sdp.type.toLowerCase(),
sdp: sdp.description
}))
Opening this back up because I dont know if this is a "bug" or not based on the documentation for RTCSessionDescription that using this method is deprecated because setLocalDescription and setRemoteDescription accept sdp that conform to RTCSessionDescriptionInit.
So does that mean the SessionDescription in this library is out of date? Feel free to close again if this isnt a bug and is correct
Hi @tyczj, the new release, version 1.3.0, is now available and includes the m125 patches. Could you check if this issue still occurs with the updated release?