[lib-jitsi-meet] Remote SDP isn't set when TraceablePeerConnection._remoteTrackAdded is called, resulting in no media lines being parsed from the SDP

I’ve been trying to get a custom client written using lib-jitsi-meet to work on iOS inside a WKWebView using a cordova wrapper. My current environment is:

iOS Version: 13.5.1
Cordova iOS: 5.1.1
cordova-plugin-iosrtc: 6.0.12
lib-jitsi-meet version: 4765 (I’ve been keeping it updated regularly over the past couple of months)

Client: A simple page with a room name text field and video tags for local and remote streams. I purposefully kept it very basic to minimize outside influence while I debug iOS specific issues.

Current Issue:

Going through the events in order, as soon as a remote peer joins a conference, there is an attempt to setRemoteDescription, and sometimes afterwards, TraceablePeerConnection._remoteTrackAdded handler is called for each audio and video track.

The handler tries to reference the remote SDP to parse media lines from, but on iOS, the remote SDP is null at this point (both this.remoteDescription and this.peerconnection.remoteDescription are null), causing the subsequent attempt to parse the SDP to fail.

I’ve noticed that on desktop chrome, this scenario never occurs. At this point in execution, the remote description is always set, but this is not the case on iOS.

If I let the app continue, and more tracks are received, the remote description is eventually set at this point. However, this part of the code is still unable to find any media lines in the SDP. Note that this exact line has a bug which I’ve fixed locally (and reported on github a couple of weeks ago, linked in reply below).

Eventually, the app finds itself in a state that even though remote peers are added (USER_JOINED events are triggered), remote tracks are still not discovered on iOS (TRACK_ADDED is never raised), so we are unable to add any video elements to the page.

I’m still trying to figure out what exactly goes wrong in the chain of events and am a little bit lost since I’m not very familiar with the internal concepts (hence going with an SDK in the first place instead of writing something ourselves) and am afraid I might be looking for issues in the wrong places when something else is actually the cause of the problem, so if anyone has any insight or can point me in the right direction, it would be really appreciated.

Thank you.

Here’s the GitHub issue I created for the bug I mentioned (had to link in a reply because I wasn’t allowed to post more than 2 links in the OP).

Hi,
I am also really interested in the solution. I hope you will manage to find out what’s wrong

Lukas