diff --git a/Sources/StreamVideo/Call.swift b/Sources/StreamVideo/Call.swift index df3869d2f..6a1aa7399 100644 --- a/Sources/StreamVideo/Call.swift +++ b/Sources/StreamVideo/Call.swift @@ -1146,6 +1146,14 @@ public class Call: @unchecked Sendable, WSEventsSubscriber { } } + func transitionDueToError(_ error: Error) { + do { + try stateMachine.transition(.error(self, error: error)) + } catch { + log.error(error) + } + } + // MARK: - private private func updatePermissions( diff --git a/Sources/StreamVideo/Controllers/CallController.swift b/Sources/StreamVideo/Controllers/CallController.swift index a8810cfcc..1caa78642 100644 --- a/Sources/StreamVideo/Controllers/CallController.swift +++ b/Sources/StreamVideo/Controllers/CallController.swift @@ -538,6 +538,9 @@ class CallController: @unchecked Sendable { call?.update(reconnectionStatus: .connected) case .error: + if let call, let errorStage = stage as? WebRTCCoordinator.StateMachine.Stage.ErrorStage { + call.transitionDueToError(errorStage.error) + } call?.leave() default: break diff --git a/StreamVideoTests/IntegrationTests/CallCRUDTests.swift b/StreamVideoTests/IntegrationTests/CallCRUDTests.swift index 0f457758e..45ea90efc 100644 --- a/StreamVideoTests/IntegrationTests/CallCRUDTests.swift +++ b/StreamVideoTests/IntegrationTests/CallCRUDTests.swift @@ -671,7 +671,6 @@ final class CallCRUDTest: IntegrationTest { } func test_joinBackstageRegularUser() async throws { - throw XCTSkip() let startingDate = Date(timeIntervalSinceNow: 30) let joiningDate = Date(timeInterval: -20, since: startingDate) let firstUserCall = client.call(callType: .livestream, callId: randomCallId) diff --git a/StreamVideoTests/IntegrationTests/IntegrationTest.swift b/StreamVideoTests/IntegrationTests/IntegrationTest.swift index 100bb3b77..29d738e50 100644 --- a/StreamVideoTests/IntegrationTests/IntegrationTest.swift +++ b/StreamVideoTests/IntegrationTests/IntegrationTest.swift @@ -9,6 +9,8 @@ import XCTest class IntegrationTest: XCTestCase { + private static var videoConfig: VideoConfig! = .dummy() + private var apiKey: String! = "" private var userId: String! = "thierry" private var baseURL: URL! = .init(string: "https://pronto.getstream.io/api/auth/create-token")! @@ -26,6 +28,11 @@ class IntegrationTest: XCTestCase { #endif } + override class func tearDown() { + Self.videoConfig = nil + super.tearDown() + } + override func tearDown() { apiKey = nil userId = nil @@ -50,7 +57,7 @@ class IntegrationTest: XCTestCase { apiKey: tokenResponse.apiKey, user: User(id: userId), token: .init(rawValue: tokenResponse.token), - videoConfig: .dummy(), + videoConfig: Self.videoConfig, pushNotificationsConfig: .init( pushProviderInfo: .init(name: "ios-apn", pushProvider: .apn), voipPushProviderInfo: .init(name: "ios-voip", pushProvider: .apn)