Error connecting to AudioNodes
Tattomoosa opened this issue · comments
I supplied an audio context to audioinput.start:
audioinput.start({ streamToWebAudio: true, audioContext: myContext });
but connecting audioinput like this doesn't work:
audioinput.connect(myContext.destination);
and this also doesn't work:
audioinput.connect(myGain);
it throws an error alert (i am using try/catch set up just like the demo) which says 'startCapture exception: Error: SyntaxError: DOM Exception 12'
but this way does work, at least it gets mic input coming out of the speakers:
audioinput.connect(audioinput.getAudioContext().destination)
I dug around in the source a bit and then checked if myContext == audioinput._audioContext and it doesn't. But it should, right?
Both myContext and audioinput._audioContext are valid audio contexts. I have some backup getUserMedia code for testing in browser, and the media stream source node it creates connects to exactly the same nodes in myContext and works just fine.
I am using Ionic, building with Ionic CLI (ionic build ios) then running on an iPhone 6 through XCode if that matters, but this seems like an issue somewhere in the javascript.
Found the problem!
A simple underscore in audioInputCapture.js, line 85:
audioinput._cfg._audioContext = cfg._audioContext || null;
This works as expected (in my app):
audioinput.start({ streamToWebAudio: true, _audioContext: myContext });
EDIT: Submitted a pull request with fix