livekit-examples / swift-example

Example app for LiveKit Swift SDK 👉 https://github.com/livekit/client-sdk-swift
https://livekit.io
Apache License 2.0
45 stars 15 forks source link

Can't connect to LiveKit room with TURN servers #13

Closed janoskranczler closed 1 year ago

janoskranczler commented 1 year ago

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.

janoskranczler commented 1 year ago

I've found the root cause of the issue and created a PR: https://github.com/livekit/client-sdk-swift/pull/174

hiroshihorie commented 1 year ago

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