livekit-examples/swift-example

Can't connect to LiveKit room with TURN servers

janoskranczler opened this issue · 2 comments

Hi!

I tried to connect to a LiveKit room with TURN servers. I changed the RoomContext.connect method to configure the servers:

        let rtcConfiguration = RTCConfiguration()
        rtcConfiguration.iceServers = [
            RTCIceServer(
                urlStrings: [
                    "turn:*********?transport=udp",
                    "turns::*********:443?transport=tcp"
                ],
                username: ":*********",
                credential: ":*********"
            )
        ]

        let connectOptions = ConnectOptions(
            autoSubscribe: !publish && autoSubscribe, // don't autosubscribe if publish mode
            rtcConfiguration: rtcConfiguration,
            publishOnlyMode: publish ? "publish_\(UUID().uuidString)" : nil
        )

But when I tried to connect with the example app I got the following error message:
image

When I try to connect to a room that doesn't require TURN, it works.

I've found the root cause of the issue and created a PR:
livekit/client-sdk-swift#174

@janoskranczler Thanks for the PR !, It has been merged so I'll close this one.