AVAudioSession gets interrupted when closing a window

I have a visionOS app that plays audio using AVAudioEngine and presents both a window and an immersive space. If I close the window, the audio session gets interrupted and attempting to restart the session and audio engine has no effect. I need to dismiss the app, then reopen it, which reopens the main window, in order for audio to start playing again.

This is in all visionOS 2 betas. Note that I have background audio enabled for my app.

We have a similar issue but with AVAudioPlayer. Dismissing then reopening immersive space / window causes the audio to stop, and attempting to call play() again has no effect.

Hey @trilorez,

This sounds like a bug. It would be great if you could file a bug report for this issue using Feedback Assistant.

@NSCruiser I'm not seeing that same behavior. I am experiencing the behavior in which the audio stops when the WindowGroup is closed and the ImmersiveSpace is still open. But calling .play() again does result in the audio resuming. In order to investigate the play() method not having any effect could you open a bug report including a sample project that replicates the issue and post the FB number here once you do.

Bug Reporting: How and Why? has tips on creating your bug report.

Thanks!

Michael

AVAudioSession gets interrupted when closing a window
 
 
Q