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

Audio output low after initializing plugin on iOS #28

Closed doender closed 7 years ago

doender commented 8 years ago

This is truly a great plugin which helped me a lot. However, I have a problem on iOS. After initializing the plugin like so:

audioinput.start({bufferSize: 8192, sampleRate: audioinput.SAMPLERATE.VOIP_16000Hz});

the subsequent audio playback, for example through <audio> or <video> tags, all have a very low volume, whereas the system level volume is at 100%. I tested it on iPhone 4S, 5S and 6S and it happens on all devices. Any idea what could cause this?

doender commented 8 years ago

I think I fixed this by changing the AVAudioSession mode from AVAudioSessionCategoryOptionMixWithOthers to AVAudioSessionCategoryOptionDefaultToSpeaker.

edimuj commented 8 years ago

Thanks for raising this issue, and for the potential fix. I'm sorry for the late reply, and will look into this as soon as I can. It would probably be best if it the AVAudioSession category, could be configured when the plugin is started along with the other parameters. There are some cordova plugins for setting the category and category options (e.g. https://github.com/eworx/av-audio-session-adapter), so it would be really good if this plugin could be extended to support something similar.

edimuj commented 7 years ago

Closing this issue, since there haven't been any activity for a while. Just give me a shout, if you want it to be reopened.

swhile commented 6 years ago

I am currently experiencing this issue, too. I fixed it by installing the av-audio-sesson-adapter plugin mentioned by @edimuj, and setting the option for AVAudioSession.CategoryOptions.DEFAULT_TO_SPEAKER after recording stops.