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

Passing in an AudioContext #1510

Open
paulrosen opened this issue Aug 17, 2021 · 0 comments
Open

Passing in an AudioContext #1510

paulrosen opened this issue Aug 17, 2021 · 0 comments

Comments

@paulrosen
Copy link

I am attempting to use my own audio context with howler. It looks like I should be able to do something like:

Howler.ctx = myAudioContext

before doing anything else but that gives me the error "SyntaxError: Source and destination nodes belong to different audio contexts".

Is there a way to have Howler use my already-initialized audio context?

---- More context on the problem ----

(This may not be the only way to fix my actual problem. Our app has been happily working for a few years but it does something odd on Safari 14. It works on earlier versions of Safari and all other supported browsers.)

You can see the actual problem by going to https://sightreadingfactory.com/practice/sr/play?keySigs=C%20Major&timeSigs=4/4&levelId=s~2&mediumId=bass in Safari 14. If you click the play button it will spin endlessly because the audiocontext is suspended. Note that other parts of the app use a different audiocontext. For instance, if you click the metronome it will start the sound right away.

The really odd thing is that if the user does anything with the mouse or keyboard it will start playing. For instance, it will start playing just by touching the SHIFT key.

And once any sound happens then everything works normally.

So I was thinking there must be some way that the audio context I use for the metronome is set up differently than the audio context for Howler and wanted to see if it would work if Howler used my audio context.

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

No branches or pull requests

1 participant