Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Enable multitasking camera access on iOS #3210

Open
2 tasks done
ethul opened this issue Sep 25, 2024 · 4 comments
Open
2 tasks done

✨ Enable multitasking camera access on iOS #3210

ethul opened this issue Sep 25, 2024 · 4 comments
Labels
✨ feature Proposes a new feature or enhancement

Comments

@ethul
Copy link

ethul commented Sep 25, 2024

What feature or enhancement are you suggesting?

Would it be possible to add support for enabling multitasking camera access?

This would be useful for apps running on iPads with Stage Manager or Split View/Slide Over turned on.

From the Apple developer documentation I tried adding the following to the camera session, which seemed to do the trick.

if #available(iOS 16.0, *) {
  if self.captureSession.isMultitaskingCameraAccessSupported {
    // Enable use of the camera in multitasking modes.
    self.captureSession.isMultitaskingCameraAccessEnabled = true
  }
}

What Platforms whould this feature/enhancement affect?

iOS

Alternatives/Workarounds

I manually made the change in Core/CameraSession.swift.

Additional information

@ethul ethul added the ✨ feature Proposes a new feature or enhancement label Sep 25, 2024
Copy link

Guten Tag, Hans here! 🍻

Zis feature request for enabling multitasking camera access on iOS is interesting, and it looks like you already made some attempts! However, we need a bit more information to evaluate zis properly. It would be helpful if you could provide any logs or error messages you encountered while implementing zis feature.

Also, if you appreciate ze work we do on zis repository, consider sponsoring the project to help us keep it going! Support mrousavy on GitHub Sponsors.

Let's keep ze conversation going!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

@ethul
Copy link
Author

ethul commented Sep 26, 2024

Without the change to enable multitasking, when Stage Manager or Split View/Slide Over was turned on, the camera preview was blank, and recording a video issued an error:

capture/unknown: Error Domain=AVFoundationErrorDomain Code=-11803 "Cannot Record" UserInfo={AVErrorRecordingFailureDomainKey=3, NSLocalizedDescription=Cannot Record, NSLocalizedRecoverySuggestion=Try recording again.}

@mrousavy
Copy link
Owner

mrousavy commented Oct 1, 2024

Hey! Oh, pretty cool. Yea I can add that feature if I have some free time soon, thanks for posting the code here this is really helpful.

@ethul
Copy link
Author

ethul commented Oct 3, 2024

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
✨ feature Proposes a new feature or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants