Skip to content

Hotfix for backgrounded/suspended IOS issue#1660

Closed
keiththomas1 wants to merge 1 commit into
goldfire:masterfrom
keiththomas1:master
Closed

Hotfix for backgrounded/suspended IOS issue#1660
keiththomas1 wants to merge 1 commit into
goldfire:masterfrom
keiththomas1:master

Conversation

@keiththomas1

Copy link
Copy Markdown
  • Verified working on IOS 14/15/16
  • Doesn't fix core of the issue, which is - on IOS we end up in the 'suspending' state when backgrounding an app, but the logic for resuming the context while 'suspending' is based on a 30 second timer that may or may not get hit depending on how long you have it backgrounded for.

Issue/Feature

Issue was that after a certain amount of time after backgrounding the app and then coming back (~10-40 secs), audio would be forever muted.

Related Issues

Solution

Reproduction/Testing

On IOS 14/15/16, background an app using Howler for 10/20/30/40/50 seconds, and then return to that app and observe if audio is working or not.

Breaking Changes

This could break instances where the state is 'running' and we should not be resuming the context because the state is not interrupted, but I haven't seen this happen yet in testing.

- Verified working on IOS 14/15/16
- Issue was that after a certain amount of time after backgrounding the
  app and then coming back (~10-40 secs), audio would be forever muted
@keiththomas1

Copy link
Copy Markdown
Author

I don't have write access, but anybody who does feel free to merge this.

@agnelrdx

Copy link
Copy Markdown

Can someone please merge this PR ??? We want the fix as we are facing issues on older IOS devices.

@caleb531

Copy link
Copy Markdown

I would love this fix as well for an app I'm working on. Is there any possibility of this being merged/published soon?

@caleb531

Copy link
Copy Markdown

For what it's worth, I realized that my particular issue with the suspending of audio (after returning from inactivity) was being caused by Howler's global autoSuspend setting, not iOS. See below:

autoSuspend Boolean true

Automatically suspends the Web Audio AudioContext after 30 seconds of inactivity to decrease processing and energy usage. Automatically resumes upon new playback. Set this property to false to disable this behavior.

Disabling this global setting solved my particular issue.

import { Howl, Howler } from 'howler';

Howler.autoSuspend = false;

Hope this helps someone!

@caleb531

caleb531 commented Aug 4, 2024

Copy link
Copy Markdown

Okay, even after setting Howler.autoSuspend = false, I was still experiencing an issue where the sound would stop playing after switching away from iOS Safari, even for a few seconds, then switching back. Applying this PR to my codebase fixed the issue immediately, so thank you @keiththomas1 for this fix!

@goldfire Any possibility of reviewing/merging this PR soon? It would be wonderful to have in the official package.

@risenxxx

risenxxx commented Aug 5, 2024

Copy link
Copy Markdown

To fix this problem, I had to use the fork too. I would be glad if this PR is reviewed faster

tommykwanpg added a commit to wegdevio/howler.js that referenced this pull request Sep 20, 2024
@aiferrer

aiferrer commented Nov 4, 2024

Copy link
Copy Markdown

We have to use this fork as well... but It would be great if you could merge this PR as soon as possible! :)

@kttmv

kttmv commented Mar 18, 2025

Copy link
Copy Markdown

I also confirm this commit fixes the issue. Any chance it could be merged?

@akicho8

akicho8 commented Oct 4, 2025

Copy link
Copy Markdown

It's been quite a while, is there a reason this hasn't been merged?

@metuuu

metuuu commented Dec 18, 2025

Copy link
Copy Markdown

I am having this issue also, and it would be really nice if this could be merged. Tested and works after this fix.

@keiththomas1

Copy link
Copy Markdown
Author

Worth mentioning here that this does not fix issue on latest IOS, please see this fix for that: #1770

pim-at-stink added a commit to Kaggle/kaggle-environments that referenced this pull request Apr 16, 2026
This fixes a bug where the audiocontext gets suspended by iOS when the
document.visibilityState changes. See

goldfire/howler.js#1660
goldfire/howler.js#1770
goldfire/howler.js#1702
goldfire/howler.js#1771

Good to note this is not a Howler bug, it's an iOS bug. We have tried
several audio libraries that all produced the same behaviour.
@keiththomas1 keiththomas1 closed this by deleting the head repository May 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants