edimuj / cordova-plugin-audioinput

This iOS/Android Cordova/PhoneGap plugin enables audio capture from the device microphone, by in near real-time forwarding audio to the web layer of your application. A typical usage scenario for this plugin would be to use the captured audio as source for a web audio node chain, where it then can be analyzed, manipulated and/or played.
https://github.com/edimuj/app-audioinput-demo
MIT License
161 stars 88 forks source link

iOS stream to web in background #99

Closed bigxd123 closed 5 years ago

bigxd123 commented 5 years ago

Hey, should the plugin work when the app goes into background?

I enabled the Audio background permission and whenever I minimize the app now it doesnt send audio to the server but as soon as it returns into foreground it sends everything at once.

So it seems like it is still recording just not sending it through the MediaStream?

` audioinput.start({ streamToWebAudio: true //audioContext: audioContext //audioSourceType: audioinput.AUDIOSOURCE_TYPE.VOICE_COMMUNICATION });

          let audioContext: AudioContext = audioinput.getAudioContext();

          let streamNode = audioContext.createMediaStreamDestination();
          audioinput.connect(streamNode);`

This is how I use the plugin. I just access the streamNode.stream and pass it to my webrtc connection which works just fine except for the described background issue.

Im using version 1.0.1 since version 1.0.2 does not work for me on iOS 12.4.