Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converting Android SessionDescription to javascript RTCSessionDescription error #178

Open
tyczj opened this issue Aug 6, 2024 · 3 comments

Comments

@tyczj
Copy link

tyczj commented Aug 6, 2024

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?

@tyczj
Copy link
Author

tyczj commented Aug 6, 2024

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
            }))

@tyczj tyczj closed this as completed Aug 6, 2024
@tyczj
Copy link
Author

tyczj commented Aug 7, 2024

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

@tyczj tyczj reopened this Aug 7, 2024
@skydoves
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants