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
1
// Sample Code. Flip Camera Face
2
3
ARGSession *argSession = [[ARGSession alloc] initWithARGConfig:argConfig error:&error];
4
ARGCamera *camera = [[ARGCamera alloc] init];
5
6
7
// ARGSession Pause
8
[argSession pause];
9
10
[camera toggleCamera:^{
11
// ARGSession Resume
12
[argSession run];
13
}];
Copied!
1
// Sample Code. Flip Camera Face
2
3
if let session = argSession {
4
5
// ARGSession Pause
6
session.pause()
7
arCamera.toggleCamera(with: .back) {
8
9
// ARGSession Resume
10
session.run()
11
}
12
}
Copied!
Last modified 1yr ago
Copy link