File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -239,18 +239,20 @@ open class Session: ObservableObject {
239239 }
240240 }
241241
242- do {
243- let response = try await fetchToken ( )
242+ let connect = { @Sendable in
243+ let response = try await self . fetchToken ( )
244+ try await self . room. connect ( url: response. serverURL. absoluteString,
245+ token: response. participantToken)
246+ }
244247
248+ do {
245249 if options. preConnectAudio {
246250 try await room. withPreConnectAudio ( timeout: timeout) {
247251 await MainActor . run { self . agent. listening ( ) }
248- try await self . room. connect ( url: response. serverURL. absoluteString,
249- token: response. participantToken)
252+ try await connect ( )
250253 }
251254 } else {
252- try await room. connect ( url: response. serverURL. absoluteString,
253- token: response. participantToken)
255+ try await connect ( )
254256 }
255257 } catch {
256258 self . error = . failedToConnect( error)
You can’t perform that action at this time.
0 commit comments