11. Switch Camera Face
To switch camera face from front to rear or vice versa, ARGSession must be paused before changing the camera face, and then resume the ARGSession in this order.
Sample code of flipping camera face is written below.
Objective-C
Swift
// Sample Code. Flip Camera Face
ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
ARGCamera *camera = [[ARGCamera alloc] init];
…
// ARGSession Pause
[argSession pause];
[camera toggleCamera:^{
// ARGSession Resume
[argSession run];
}];
// Sample Code. Flip Camera Face
if let session = argSession {
// ARGSession Pause
session.pause()
arCamera.toggleCamera(with: .back) {
// ARGSession Resume
session.run()
}
}
Last modified 3yr ago