Closed mreinstein closed 7 years ago
@edimuj I've tried locally modifying the plugin to get a success callback to fire, but I wasn't having much luck. Here are the changes I tried:
In audioInputCapture.js
audioinput.stop = function () {
if (audioinput._capturing) {
audioinput._capturing = false;
exec(audioinput._audioInputStopEvent, audioinput._audioInputErrorEvent, "AudioInputCapture", "stop", [ ]);
}
if (audioinput._cfg.streamToWebAudio) {
if (audioinput._timerGetNextAudio) {
clearTimeout(audioinput._timerGetNextAudio);
}
audioinput._audioDataQueue = null;
}
};
audioinput._audioInputStopEvent = function (e) {
cordova.fireWindowEvent("audioinputerror", { message: 'noerror' });
};
Maybe I'm missing changes in the native side to get the success callback to fire? I'm unsure. Any thoughts/feedback would be welcome. Happy to submit a PR if we can get this working.
@mreinstein thanks. I'll start looking into this next week. I agree, there is probably some stuff needed on the native side to get the callback working, both on iOS and Android.
@mreinstein sorry for the long delay, I have been extremely busy with commercial projects since summer. If you submit a PR, I’ll be happy to merge it.
@edimuj no worries, I've actually moved away from native to web development for this application. As of ios11, safari supports microphone input! :)
Looking at this line: https://github.com/edimuj/cordova-plugin-audioinput/blob/master/www/audioInputCapture.js#L136
The first parameter is the success callback according to https://cordova.apache.org/docs/en/latest/guide/hybrid/plugins/#the-javascript-interface
I'm wondering if there's a way we can fire an event when the microphone stops. I'm having an issue with my application where I call
audioinput.stop()
, and then I immediately play some web audio. The audio starts playing with reduced volume. Eventually the microphone stops, and then the playing audio goes to full volume. Having a way to know when the microphone is no longer acquiring data enables me to wait before playing the audio