Skip to content

Error: Unhandled Promise Rejection: InvalidStateError: Failed to start the audio device - interrupted context state - #1743

@aiferrer

Description

@aiferrer

The Problem

I have an issue in my app when I use the iPad (only on iPad) and press the home button to close and reopen the app.
Error: Unhandled Promise Rejection: InvalidStateError: Failed to start the audio device
AudioContext state: – "interrupted"
I was testing the Howler TESTs on the iPad and I have the error in the console for both the WEB AUDIO TEST and the Spatial Audio TEST from howler examples, you can reproduce this error.

iPad - iPadOS 17.7.1

Reproducible Example

https://howlerjs.com/assets/howler.js/examples/3d/

Reproduction Steps

Use an iPad with S.O: iPadOS 17.7.1
Use a Safari Tecnology Preview and use Develop Tool to open a console linked to your iPad.
Open https://howlerjs.com/assets/howler.js/examples/3d/ -> SPATIAL AUDIO TEST
or BASIC FUNCTIONS -> RUN WEB AUDIO TESTS

Press HOME button in your iPad to bring the app to the background and wait for a few seconds... you will see this error in console.
Error: Unhandled Promise Rejection: InvalidStateError: Failed to start the audio device

And the audio will disappear..

Possible Solution

Improve the _autoResume function especially to more robustly handle the interrupted state on iOS.

Context

It affects the development of a language learning game.

Howler.js Version

v2.2.4

Affected Browser(s)/Versiuon(s)

iPadOS 17.7.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions