Skip to content

Commit e218add

Browse files
committed
orientation change fix
1 parent 60a76f1 commit e218add

File tree

3 files changed

+107
-9
lines changed

3 files changed

+107
-9
lines changed

quickstart-ios-swift.xcodeproj/project.pbxproj

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -445,18 +445,19 @@
445445
buildSettings = {
446446
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
447447
CODE_SIGN_STYLE = Automatic;
448-
DEVELOPMENT_TEAM = 339454YJJ4;
448+
DEVELOPMENT_TEAM = "";
449449
FRAMEWORK_SEARCH_PATHS = (
450450
"$(inherited)",
451451
"$(PROJECT_DIR)/quickstart-ios-swift/Frameworks",
452452
"$(PROJECT_DIR)",
453453
);
454454
INFOPLIST_FILE = "quickstart-ios-swift/Info.plist";
455+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
455456
LD_RUNPATH_SEARCH_PATHS = (
456457
"$(inherited)",
457458
"@executable_path/Frameworks",
458459
);
459-
PRODUCT_BUNDLE_IDENTIFIER = "ai.deepar.quickstart-ios-swift";
460+
PRODUCT_BUNDLE_IDENTIFIER = "ai.deepar.quickstart-ios-objc";
460461
PRODUCT_NAME = "$(TARGET_NAME)";
461462
SWIFT_VERSION = 5.0;
462463
TARGETED_DEVICE_FAMILY = "1,2";
@@ -468,18 +469,19 @@
468469
buildSettings = {
469470
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
470471
CODE_SIGN_STYLE = Automatic;
471-
DEVELOPMENT_TEAM = 339454YJJ4;
472+
DEVELOPMENT_TEAM = "";
472473
FRAMEWORK_SEARCH_PATHS = (
473474
"$(inherited)",
474475
"$(PROJECT_DIR)/quickstart-ios-swift/Frameworks",
475476
"$(PROJECT_DIR)",
476477
);
477478
INFOPLIST_FILE = "quickstart-ios-swift/Info.plist";
479+
IPHONEOS_DEPLOYMENT_TARGET = 13.4;
478480
LD_RUNPATH_SEARCH_PATHS = (
479481
"$(inherited)",
480482
"@executable_path/Frameworks",
481483
);
482-
PRODUCT_BUNDLE_IDENTIFIER = "ai.deepar.quickstart-ios-swift";
484+
PRODUCT_BUNDLE_IDENTIFIER = "ai.deepar.quickstart-ios-objc";
483485
PRODUCT_NAME = "$(TARGET_NAME)";
484486
SWIFT_VERSION = 5.0;
485487
TARGETED_DEVICE_FAMILY = "1,2";
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "1200"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "19FB9DA0239E65EC0056E3AB"
18+
BuildableName = "quickstart-ios-swift.app"
19+
BlueprintName = "quickstart-ios-swift"
20+
ReferencedContainer = "container:quickstart-ios-swift.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
24+
</BuildAction>
25+
<TestAction
26+
buildConfiguration = "Debug"
27+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
28+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
29+
shouldUseLaunchSchemeArgsEnv = "YES">
30+
<Testables>
31+
</Testables>
32+
</TestAction>
33+
<LaunchAction
34+
buildConfiguration = "Debug"
35+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
36+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
37+
launchStyle = "0"
38+
useCustomWorkingDirectory = "NO"
39+
ignoresPersistentStateOnLaunch = "NO"
40+
debugDocumentVersioning = "YES"
41+
debugServiceExtension = "internal"
42+
allowLocationSimulation = "YES">
43+
<BuildableProductRunnable
44+
runnableDebuggingMode = "0">
45+
<BuildableReference
46+
BuildableIdentifier = "primary"
47+
BlueprintIdentifier = "19FB9DA0239E65EC0056E3AB"
48+
BuildableName = "quickstart-ios-swift.app"
49+
BlueprintName = "quickstart-ios-swift"
50+
ReferencedContainer = "container:quickstart-ios-swift.xcodeproj">
51+
</BuildableReference>
52+
</BuildableProductRunnable>
53+
</LaunchAction>
54+
<ProfileAction
55+
buildConfiguration = "Release"
56+
shouldUseLaunchSchemeArgsEnv = "YES"
57+
savedToolIdentifier = ""
58+
useCustomWorkingDirectory = "NO"
59+
debugDocumentVersioning = "YES">
60+
<BuildableProductRunnable
61+
runnableDebuggingMode = "0">
62+
<BuildableReference
63+
BuildableIdentifier = "primary"
64+
BlueprintIdentifier = "19FB9DA0239E65EC0056E3AB"
65+
BuildableName = "quickstart-ios-swift.app"
66+
BlueprintName = "quickstart-ios-swift"
67+
ReferencedContainer = "container:quickstart-ios-swift.xcodeproj">
68+
</BuildableReference>
69+
</BuildableProductRunnable>
70+
</ProfileAction>
71+
<AnalyzeAction
72+
buildConfiguration = "Debug">
73+
</AnalyzeAction>
74+
<ArchiveAction
75+
buildConfiguration = "Release"
76+
revealArchiveInOrganizer = "YES">
77+
</ArchiveAction>
78+
</Scheme>

quickstart-ios-swift/ViewController.swift

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ class ViewController: UIViewController {
142142
NotificationCenter.default.addObserver(self, selector: #selector(orientationDidChange), name: UIDevice.orientationDidChangeNotification, object: nil)
143143
}
144144

145+
override func viewWillLayoutSubviews() {
146+
super.viewWillLayoutSubviews()
147+
arView.frame = self.view.bounds
148+
}
149+
145150
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
146151
super.viewWillTransition(to: size, with: coordinator)
147152
// sometimes UIDeviceOrientationDidChangeNotification will be delayed, so we call orientationChanged in 0.5 seconds anyway
@@ -156,10 +161,11 @@ class ViewController: UIViewController {
156161

157162
self.deepAR = DeepAR()
158163
self.deepAR.delegate = self
159-
self.deepAR.setLicenseKey("your_license_key_here")
164+
self.deepAR.setLicenseKey("your_licence_key")
160165

161166
cameraController = CameraController()
162167
cameraController.deepAR = self.deepAR
168+
self.deepAR.videoRecordingWarmupEnabled = true;
163169

164170
self.arView = self.deepAR.createARView(withFrame: self.arViewContainer.frame) as! ARView
165171
self.arView.translatesAutoresizingMaskIntoConstraints = false
@@ -168,7 +174,7 @@ class ViewController: UIViewController {
168174
self.arView.rightAnchor.constraint(equalTo: self.arViewContainer.rightAnchor, constant: 0).isActive = true
169175
self.arView.topAnchor.constraint(equalTo: self.arViewContainer.topAnchor, constant: 0).isActive = true
170176
self.arView.bottomAnchor.constraint(equalTo: self.arViewContainer.bottomAnchor, constant: 0).isActive = true
171-
177+
172178
cameraController.startCamera()
173179
}
174180

@@ -248,7 +254,7 @@ class ViewController: UIViewController {
248254
let height: Int32 = Int32(deepAR.renderingResolution.height)
249255

250256
if (currentRecordingMode == RecordingMode.video) {
251-
deepAR.startVideoRecording(withOutputWidth: width, outputHeight: height)
257+
deepAR.resumeVideoRecording()
252258
isRecordingInProcess = true
253259
return
254260
}
@@ -343,9 +349,13 @@ class ViewController: UIViewController {
343349
extension ViewController: DeepARDelegate {
344350
func didFinishPreparingForVideoRecording() { }
345351

346-
func didStartVideoRecording() { }
352+
func didStartVideoRecording() {
353+
NSLog("didStartVideoRecording!!!!!")
354+
}
347355

348356
func didFinishVideoRecording(_ videoFilePath: String!) {
357+
358+
NSLog("didFinishVideoRecording!!!!!")
349359

350360
let documentsDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true).first!
351361
let components = videoFilePath.components(separatedBy: "/")
@@ -385,7 +395,15 @@ extension ViewController: DeepARDelegate {
385395
}
386396
}
387397

388-
func didInitialize() {}
398+
func didInitialize() {
399+
let width: Int32 = Int32(deepAR.renderingResolution.width)
400+
let height: Int32 = Int32(deepAR.renderingResolution.height)
401+
402+
if (currentRecordingMode == RecordingMode.video) {
403+
deepAR.startVideoRecording(withOutputWidth: width, outputHeight: height)
404+
return
405+
}
406+
}
389407

390408
func faceVisiblityDidChange(_ faceVisible: Bool) {}
391409
}

0 commit comments

Comments
 (0)