nextcloud / nextcloud/talk-ios
Connections may not be established with a browser participant that is not publishing
- Dominant language
- Swift
- Stars
- 230
- Forks
- 121
- Avg merge
- 1d 6h
- Merged PRs (30d)
- 38
Description
Talk iOS equivalent of https://github.com/nextcloud/talk-android/issues/2679. Note that I have **not** actually tested it in iOS, but the bug should happen [based on the code](https://github.com/nextcloud/talk-ios/blob/6c9ca5cf1f431dc8e5736642ad44b9b858c6cc07/NextcloudTalk/NCCallController.m#L886-L892) (but please check it :-) )
When the HPB is not used the participant with the _higher_ session ID sends an offer to the participant with the _lower_ session ID to establish the connection. However, [if a participant is not publishing any media it will not send an offer and just expect that the other participant sends it if needed (that is, if the other participant is publishing media)](https://github.com/nextcloud/spreed/blob/4c8d16a3f48c6f7b77c94771c6aee6970578fa0b/src/utils/webrtc/webrtc.js#L379-L406). The iOS app does not take that into account, and it assumes that if the other participant has a higher session ID the other participant will send an offer. Therefore, when the browser is not publishing media and has a higher session ID no connection is established between the browser and the iOS app, as both are expecting the other participant to send an offer.
I guess that it could be fixed by replacing [`if (result == NSOrderedAscending) {`](https://github.com/nextcloud/talk-ios/blob/6c9ca5cf1f431dc8e5736642ad44b9b858c6cc07/NextcloudTalk/NCCallController.m#L887) with `if (result == NSOrderedAscending || ![self userHasStreams:sessionId]) {` (or something similar... I am not familiar with this devilish syntax :-P ). Like the current code, that does not take into account whether the iOS app is sending media or not, but I guess that could require other changes, and although related it is a different issue.
## Steps to reproduce
- Do not setup the HPB
- Open a conversation in the iOS app
- Open the same conversation in the browser
- Check if the session ID of the browser participant is higher than the session ID of the iOS participant; if not, reload the page until it is
- You can check the sessions in the browser console with `store.getters.participantsList(THE_CONVERSATION_TOKEN).forEach(participant => console.log(participant.actorId + " " + participant.sessionIds))`
- For the comparison purposes note that "0" < "9" < "A" < "Z" < "a" < "z"
- Start a call in the iOS app
- Join the call in the browser without microphone nor camera
### Expected behaviour
The connection with the iOS participant is established in the browser
### Actual behaviour
The connection with the iOS participant is not established in the browser (a spinner is shown)
Contributor guide
Assessment
This issue has not been assessed yet.