here is how i add an audio player to a SCNNodelet audioSource = SCNAudioSource(fileNamed: nodeName)
audioSource?.volume = 1
audioSource?.loops = true
audioSource?.load()
audioSource?.isPositional = true
let audioPlayer = SCNAudioPlayer(source: audioSource!)
node.addAudioPlayer(audioPlayer)i try to pause the audioPlayer but it doesn'taudioPlayer.audioNode?.engine?.pause()I am trying to pause the audioPlayer because when Replaykit's alert appears (user permission) it pauses my AR scene but not my audioplayers so the sounds are out of sync with the SCNNode when the alert is dismissed. any idea on how i can pause a SCNAudioPlayer ?thanks
Post
Replies
Boosts
Views
Activity
I have an ARKit app that plays sounds using playaudio
let audioPlay = SCNAction.playAudio(audioSource!, waitForCompletion: false)
when the app moves to the background i get the following :
AURemoteIO.cpp:1590:Start: AUIOClientStartIO failed (561015905)
AVAEInternal.h:109 [AVAudioEngineGraph.mm:1544:Start: (err = PerformCommand(*ioNode, kAUStartIO, NULL, 0)): error 561015905
when it comes back to the foreground and a sound is played it crashes and i get the following:
[avae] AVAEInternal.h:76 required condition is false: [AVAudioPlayerNode.mm:712:ScheduleBuffer: (outputFormat.channelCount == buffer.format.channelCount)]
in crash logs the crash is happening here :
AVAudioFileImpl::CheckClientFormatSet() + 60
tried fixes: Enable background audio works but my app does not have any logical use for background audio
self.sceneView.audioEngine.mainMixerNode.outputVolume = 0.0 when app moves to background. still crashes but less often
Any help would be appreciated.
Hello,
When the in app purchase payment sheet is presented, the ARKit session is interrupted.
Does anyone know if i can change the presentation style of the sheet?
Thank you!
Hi,
Is there a way to set LiDAR as a Required Device Capability ?
Hi everyone,
I have a content view that declares a StateObject
@StateObject var appModel: AppModel = AppModel.instance
I present the content view from a uikit view:
let swiftUIView = ContentView()
let hostingController = UIHostingController(rootView: swiftUIView)
hostingController.modalPresentationStyle = .fullScreen
DispatchQueue.main.async{
self.present(hostingController, animated: true, completion: nil)
}
I dismiss the contentview this way:
struct DismissingView: View {
@Environment(\.dismiss) var dismiss
var body: some View {
Button(action: {
dismiss()
}
, label: {
VStack(spacing: 10) {
Image(systemName: "xmark")
.resizable()
.aspectRatio(contentMode: .fit)
.frame(width: 22)
}
.foregroundColor(.white)
})
}
}
when I dismiss the content view I want to deallocate everything, but the stateobject remains. I have tried changing it to an observedObject with no success.
Any idea how to deallocate everything? Thank you
Hi,
In the scanning objects using object capture project, when the content view is dismissed the AppDataModel is always retained and the deinit is never called.
@StateObject var appModel: AppDataModel = AppDataModel.instance
I am presenting the contentView using a UIHostingController
let hostingController = UIHostingController(rootView: ContentView())
hostingController.modalPresentationStyle = .fullScreen
present(hostingController, animated: true)
I have tried to manually detach the listeners and setting the objectCaptureSession to nil.
In the debug memory graph there is a coachingoverlay retaining the AppDataModel.
I want to remove the appModel from memory when the contentView is dismissed.
Any suggestions?
Hi,
My app launches with a mixed immersive space. the Preferred Default Scene Session Role is set to Immersive Space Application Session Role.
ImmersiveSpace(id: "sceneSpace"){
ImmersiveView()
.environmentObject(modelObject)
}.immersionStyle(selection: .constant(.mixed), in: .mixed)
Other WindowGroups are opened too.
Problem:
When the x button (bottom left corner) is tapped on any WindowGroup the immersive space is dismissed.
When the user opens the app again the immersive space is gone.
The same happens when the user opens the Home Screen.
How can I keep the same immersive space when the app is opened again.
Thank you!