Skip to content

Commit

Permalink
Background camera access check
Browse files Browse the repository at this point in the history
  • Loading branch information
ipavlidakis committed Dec 12, 2024
1 parent 8aae0d7 commit 738154f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 738154f

Please sign in to comment.