-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
fix: initialize audio context only with user interaction #5444
fix: initialize audio context only with user interaction #5444
Conversation
This seems like a simple fix that should not be hard to test |
Hmm, I have a question... isn't that |
3d86481
to
39ceac4
Compare
@apple502j Let me also add a test for this. |
Hmm, I don't think we need |
@apple502j That's good to know, thank you. As the original issue still exists, we still need to have new audio context initialization. Turned out the audio context initialization issue exists in three places. Here is a screenshot on Chrome from the latest develop branch(hash). Where the issue happens1. src/lib/audio/shared-audio-context.js#6 2. node_modules/audio-context/index.js#36 3. node_modules/startaudiocontext/StartAudioContext.js#114 |
565e1bf
to
c3b3257
Compare
@benjiwheeler Thank you for your comment. I just added tests. |
This PR causes a bug where the sound tab will crash due to undefined audio context in the situation where you have a device with
Yeah @apple502j it definitely is, so I'm pretty confused about why it wasn't working. Ideally we can remove any synchronous uses of AudioContext and move everything to a promise, although that might be hard because we may rely on synchronous access to the audio context in many places. A simple fix for right now will be to just bind to both those events and unbind both to cover the bases, although that still leaves open the 2 questions: (1) why startaudiocontext wasnt doing its job, (2) is there a way to not rely on audiocontext being available right away. |
Resolves
Proposed Changes
Add a one-dispatch event listener to trigger the shared audio context.
Reason for Changes
To help developers to debug by removing a warning.
Test Coverage
Added new unit tests for
shared-audio-context.js
.Browser Coverage
Check the OS/browser combinations tested (At least 2)
Mac
Windows
Chromebook
iPad
Android Tablet