Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix for backgrounded/suspended IOS issue #1660

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

keiththomas1
Copy link

  • 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
Author

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

@agnelrdx
Copy link

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

@caleb531
Copy link

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

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
Copy link

caleb531 commented Aug 4, 2024

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.

@risen228
Copy link

risen228 commented Aug 5, 2024

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
Copy link

aiferrer commented Nov 4, 2024

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

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.

7 participants