fix: emulator audio throwing when resuming from background ios #390

Merged
thenick775 merged 3 commits from fix-emulator-audio-throwing-when-resuming-from-background-ios into master 2025-12-02 20:34:52 -05:00
thenick775 commented 2025-12-02 01:28:17 -05:00 (Migrated from github.com)

High level Details

Closes: #388

This is an attempt to better handle errors of the form Unhandled Promise Rejection: InvalidStateError: Failed to start the audio device coming out of resuming the audio device.

Today, the audio context can get into a broken state, where it transitions from interrupted -> running even though it's not playing audio. Additionally, there was a simpler case where it just threw attempting to resume the audio.

The goal of this pr is to address both of the issues above by suspending the context, and then resuming hoping for a teardown and reconstruction of the audio pipeline.

Appears to work better with a timeout thus far.

References:

### High level Details Closes: #388 This is an attempt to better handle errors of the form `Unhandled Promise Rejection: InvalidStateError: Failed to start the audio device` coming out of resuming the audio device. Today, the audio context can get into a broken state, where it transitions from `interrupted` -> `running` even though it's not playing audio. Additionally, there was a simpler case where it just threw attempting to resume the audio. The goal of this pr is to address both of the issues above by suspending the context, and then resuming hoping for a teardown and reconstruction of the audio pipeline. Appears to work better with a timeout thus far. References: - https://github.com/phaserjs/phaser/issues/6829#issuecomment-2620908671 - https://forum.playcanvas.com/t/ios-audio-not-resuming-after-standby/26408
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
thenick775/gbajs3!390
No description provided.