Is there front facing camera support with ARKit?

8.6k Views Asked by At

How can we access Front Facing Camera Images with ARCamera or ARSCNView and is it possible to record ARSCNView just like Camera Recording?

3

There are 3 best solutions below

1
On

As far as I know, ARKit with Front Facing Camera is only supported for iPhone X.

Here's Apple's sample code regarding this topic.

2
On

Regarding the front-facing camera: in short, no.

ARKit offers two basic kinds of AR experience:

  • World Tracking (ARWorldTrackingConfiguration), using the back-facing camera, where a user looks "through" the device at an augmented view of the world around them. (There's also AROrientationTrackingConfiguration, which is a reduced quality version of world tracking, so it still uses only the back-facing camera.)

  • Face Tracking (ARFaceTrackingConfiguration), supported only with the front-facing TrueDepth camera on iPhone X, where the user sees an augmented view of theirself in the front-facing camera view. (As @TawaNicolas notes, Apple has sample code here... which, until iPhone X actually becomes available, you can read but not run.)

In addition to the hardware requirement, face tracking and world tracking are mostly orthogonal feature sets. So even though there's a way to use the front facing camera (on iPhone X only), it doesn't give you an experience equivalent to what you get with the back facing camera in ARKit.


Regarding video recording in the AR experience: you can use ReplayKit in an ARKit app same as in any other app.

If you want to record just the camera feed, there isn't a high level API for that, but in theory you might have some success feeding the pixel buffers you get in each ARFrame to AVAssetWriter.

0
On

If you want to access the UIKit or AVFoundation cameras, you still can, but separately from ARSCNView. E.g., I'm loading UIKit's UIImagePickerController from an IBAction and it is a little awkward to do so, but it works for my purposes (loading/creating image and video assets).