Camera preview fails in split view mode on iPad

Hi,


I have a universal app that uses the camera along with a preview layer (AVCaptureVideoPreviewLayer) to display a preview of the live camera view.


It works fine on an iPhone and fine on an iPad as long as my app is full screen.


However, if I open another app in split-view mode, my app loses its live camera view and freezes on the last frame captured.


I've tried stopping the AVCaptureSession before the transition and restarting it afterward, and even tearing the whole thing down and building a new one, but neither works.


My app is checking permissions and the permissions are fine, and all of the objects created seem valid.


Is there some rule that disallows apps from accessing the camera in split screen mode?


Frank

Replies

It is known (and I experienced for a QRCode reading) that preview has some limits (not to say issues).


For instance, it is recommended to use it in Portrait and not rotate to Landscape. May be the problem you have.


May have a look here:

h ttps://stackoverflow.com/questions/31915354/how-to-use-avcapturesession-with-slide-over-and-split-view-in-ios-9

Camera usage is not allowed in a multi app environment. If you pay attention to AVCaptureSession's

AVCaptureSessionWasInterruptedNotification, you can parse its AVCaptureSessionInterruptionReasonKey, one of which is:


AVCaptureSessionInterruptionReasonVideoDeviceNotAvailableWithMultipleForegroundApps

An interruption caused when your app is running in Slide Over, Split View, or Picture in Picture mode on iPad, causing resource contention and degraded recording quality of service.

use "com.apple.developer.avfoundation.multitasking-camera-access"
@satire
can you tell me how can I use it or leave some contact way