How can we access Front Facing Camera Images with ARCamera
or ARSCNView
and is it possible to record ARSCNView
just like Camera Recording?
3 Answers
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 alsoAROrientationTrackingConfiguration
, 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
.

- 124,678
- 26
- 272
- 326
-
is there any Sample code To Record your my ARSCNView – Bharrath Oct 13 '17 at 12:59
-
is there is any Sample Code to To Take Image of my ARSCNView – Bharrath Oct 13 '17 at 13:10
As far as I know, ARKit with Front Facing Camera is only supported for iPhone X.

- 636
- 1
- 5
- 11
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).

- 654
- 7
- 10