feat(ios): add iPad multitasking camera support #3695
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for iPad Split View / Slide Over multitasking:
isMultitaskingCameraAccessEnabledon iOS 16+ devices that support itAVCaptureSessionWasInterruptedsession/multitasking-camera-not-supportederror to JS when camera is interrupted due tovideoDeviceNotAvailableWithMultipleForegroundAppsProblem
On iPad, when the app is in Split View or Slide Over with another app, the camera shows a black screen. There's no feedback to the user about why the camera isn't working.
Solution
isMultitaskingCameraAccessEnabledso the camera works in split viewsession/multitasking-camera-not-supported) to the JS side so apps can show a user-friendly message explaining the limitationChanges
CameraSession.swift: Added interruption observers and multitasking enable logicCameraError.swift: Added newSessionError.multitaskingCameraNotSupportedcaseUsage
Apps can handle the error in
onError:Testing
Tested on:
session/multitasking-camera-not-supportederror in Split View, camera auto-restarts when returning to full screen