ARVideoKit
ARVideoKit copied to clipboard
SceneKit Audio Causes Immediate Crash on Record
![callstack](https://user-images.githubusercontent.com/19663985/39401370-773025a4-4b3b-11e8-9da6-1db9a0ff1310.png)
![workspace](https://user-images.githubusercontent.com/19663985/39401372-82687f5c-4b3b-11e8-817c-69fa9321dac2.png)
iPhone X iOS 11.3 ARSCNView Any ideas?
@gheatley, can you share how you're configuring RecordAR
object in your project?
pretty much as mandated:
func viewDidLoad() {
//ARVideoKit
arVideoKitRecorder = RecordAR(ARSceneKit: ARView)
// Set the recorder's delegate
arVideoKitRecorder?.delegate = self
// Set the renderer's delegate
arVideoKitRecorder?.renderAR = self
// Configure the renderer to perform additional image & video processing 👁
arVideoKitRecorder?.onlyRenderWhileRecording = true
// Configure ARKit content mode. Default is .auto
arVideoKitRecorder?.contentMode = .aspectFill
//record or photo add environment light rendering, Default is false
arVideoKitRecorder?.enableAdjsutEnvironmentLighting = false
// Set the UIViewController orientations
arVideoKitRecorder?.inputViewOrientations = [.landscapeLeft, .landscapeRight, .portrait]
// Configure RecordAR to store media files in local app directory
arVideoKitRecorder?.deleteCacheWhenExported = true
}
This startSession is NOT called from viewWillAppear()
func startSession() {
guard ARWorldTrackingConfiguration.isSupported else { showUnsupportedDeviceError(); return }
configuration.detectionImages = referenceImages
configuration.planeDetection = planeDetectionConfig
arVideoKitRecorder?.prepare(configuration)
ARView.session.run(configuration)
sessionIsPaused = false
}
Recording triggered like so:
func presentCamera() {
var result = "DEFAULT"
switch arVideoKitRecorder!.status {
case RecordARStatus.unknown:
result = "unknown"
break
case RecordARStatus.readyToRecord:
result = "readyToRecord"
break
case RecordARStatus.recording:
result = "recording"
break
case RecordARStatus.paused:
result = "paused"
break
}
#if DEBUG
log(self, message: "arVideoKitRecorder?.status:\(result)")
#endif
//Record
if arVideoKitRecorder?.status == .readyToRecord {
#if DEBUG
log(self, message: "Go")
#endif
recordingQueue.async { self.arVideoKitRecorder?.record() }
} else if arVideoKitRecorder?.status == .recording {
arVideoKitRecorder?.stop() { path in
self.arVideoKitRecorder?.export(video: path) { saved, status in
//DispatchQueue.main.sync {
// self.exportMessage(success: saved, status: status)
//}
}
}
}
I have tinkered-around with the settings to try different things to no avail. I DID manage to get it to record once successfully though. (Beautiful results btw). Have tried starting the record both with & without being on those queues.
Looks like it's mentioning audio there at the top of the stack. Maybe if Mic recording is disabled? I am using 3D positional audio in the scene.. if that would affect things in any way..
NB: After further playing, GIFs crash too exactly the same. However, Photos & LivePhotos work fine.
Ok. I've found what's causing it: Audio played on SceneKit Nodes. I can't be sure if it's strictly nodes employing positional audio or just any nodes playing audio at all in the SCNScene (as I'm using both). But as soon as i detatch my SCNNodes which have audio playing & then run & record, it works! Any way to fix this?
@gheatley, try this:
recorder?.enableMixWithOthers = false
That reduces the crash rate to about just 50% of the time. However there is no audio at all (nor the mic audio) in the finished recordings.
@gheatley, I'll try to reproduce this bug and get back to you soon.
@AFathi Any luck?
not sure , but try this
screenRecorder?.requestMicPermission = .manual
my crash got fixed by this.
Thanks for the suggestion @devajith . Have tried it & sadly this doesn't fix the problem.