-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
SoundManager is always suspended
when AudioContext not available, preventing sound playback
#4757
Comments
pc-issue-4757.zip
|
@roger-o3h is this a regression issue (ie was this working in a previous release of the engine)? |
Yes, was working at least up to 1.52.6. I think this introduced the error #4462 around 1.56 |
Just to update, after applying #4788, the issue with legacy html audio is still present. In
and in the new logic, suspended is still dependent on an
With legacy html audio, there will never be a One way to fix this would now be to change
Or, something could be changed in Grateful for the related fix! Only trying to be helpful in keeping this bug report up to date 🙏 |
@roger-o3h Thanks for this info!! I'm sure @slimbuck will get back to you on this tomorrow. But just to confirm, presumably legacy HTML Audio is only used in IE11 these days, right? |
It's true, should be very uncommon now, but I do hope you continue to support it, as we are using a Just one user, but it's totally fine with me if, for instance, the "suspend" behaviour is dropped for this legacy mode... we just hope it continues to be an option. |
Description
When you are running in an environment without html5 web audio —
hasAudioContext()
is false (https://github.com/playcanvas/engine/blob/main/src/platform/audio/capabilities.js#L8) — the SoundManager always reports that it issuspended
(https://github.com/playcanvas/engine/blob/main/src/platform/sound/manager.js#L117) because its_context
is always null. A downstream problem this creates is that audio clips will never play.Furthermore,
_unlocked
never has an opportunity to be set totrue
without AudioContext being present, as the only place it's set is the lazy creation of the AudioContext (https://github.com/playcanvas/engine/blob/main/src/platform/sound/manager.js#L139-L142) and this too causes SoundManager to perpetually report it is in asuspended
state, preventing sound playback.One potential fix would be to provide different implementations of
suspended
getter:I think this is somewhat critical as it seems to break all sound playback in our project. We have a polyfill for
HTMLAudioElement
in order to route audio through our native app hosting the web view. We force PC to use legacy sound mode bybefore loading in PC. (It would be cool to have an option to do this, like the OPPOSITE of
forceWebAudioApi
). Our situation is a bit weird, but this issue should equally affect folks who truly don't support html5 web audio.I'm building a minimal test case and will edit and attach it when complete.
The text was updated successfully, but these errors were encountered: