in iOS WebAudio streams buffer is empty
See original GitHub issueHi, I’m on iOS, trying to get mic stream and send to Google Cloud Speech to Text service. So I need a replacement for getUserMedia, and splicing the Google sample and one of the example in one of the closed issues I did:
context = new AudioContext({latencyHint: 'interactive'});'
var processor = this.context.createScriptProcessor(2048, 1, 1);
processor.connect(context.destination);
audioinput.start({streamToWebAudio: true})
var dest = audioinput.getAudioContext().createMediaStreamDestination();
audioinput.connect(dest);
var stream = dest.stream;
var input = context.createMediaStreamSource(stream);
input.connect(processor);
processor.onaudioprocess = (e)=>{
var left = e.inputBuffer.getChannelData(0)
console.log(left)//<---buffer seems empty
; };
I did get the mic permission popup the first time around so I think the mic was listening. I am total noob on audio, any tips to get mic stream greatly appreciated.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I managed to achieve my original goal of getting mic input’s stream in iOS and sending it to speech recognition service by getting a MediaStream out of the audioInput. The root cause of my problem was v 1.0.2 doesn’t work on iOS for me, reverting back to v 1.0.1 fixed this. Plugin works great - thanks @edimuj for this!
Thanks for the response and link to sample code! The sample app works, as I can hear my mic input echoed back.
I should have mentioned that I’m using ionic capacitor which is largely cordova plugin compatible. With the cordova app sample in hand, I can start to investigate the issue on capacitor.