diff --git a/Sources/StreamVideo/WebRTC/v2/VideoCapturing/ActionHandlers/Camera/CameraBackgroundAccessHandler.swift b/Sources/StreamVideo/WebRTC/v2/VideoCapturing/ActionHandlers/Camera/CameraBackgroundAccessHandler.swift index dfd644a98..2d70ae5d0 100644 --- a/Sources/StreamVideo/WebRTC/v2/VideoCapturing/ActionHandlers/Camera/CameraBackgroundAccessHandler.swift +++ b/Sources/StreamVideo/WebRTC/v2/VideoCapturing/ActionHandlers/Camera/CameraBackgroundAccessHandler.swift @@ -16,7 +16,8 @@ final class CameraBackgroundAccessHandler: StreamVideoCapturerActionHandler { switch action { case let .checkBackgroundCameraAccess(videoCaptureSession) - where videoCaptureSession.isMultitaskingCameraAccessSupported == true: + where videoCaptureSession.isMultitaskingCameraAccessSupported == true && videoCaptureSession + .isMultitaskingCameraAccessEnabled == false: videoCaptureSession.beginConfiguration() videoCaptureSession.isMultitaskingCameraAccessEnabled = true videoCaptureSession.commitConfiguration() diff --git a/Sources/StreamVideo/WebRTC/v2/VideoCapturing/StreamVideoCapturer.swift b/Sources/StreamVideo/WebRTC/v2/VideoCapturing/StreamVideoCapturer.swift index 2b42c6a83..5d8287335 100644 --- a/Sources/StreamVideo/WebRTC/v2/VideoCapturing/StreamVideoCapturer.swift +++ b/Sources/StreamVideo/WebRTC/v2/VideoCapturing/StreamVideoCapturer.swift @@ -208,6 +208,12 @@ actor StreamVideoCapturer { dimensions: CGSize, frameRate: Int ) async throws { + if let videoCaptureSession { + _ = try await enqueueOperation( + for: .checkBackgroundCameraAccess(videoCaptureSession) + ).value + } + _ = try await enqueueOperation( for: .startCapture( position: position,