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.

Home Page:https://github.com/edimuj/app-audioinput-demo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

App crash on iOS 11

swhile opened this issue · comments

Hi. First, I love this plugin because it gets the microphone permission on iOS without opening a separate recorder app. We use it in a language learning app to parse speech with the Google Speech API.

Has the plugin been tested with iOS 11 yet? I'm using version 0.3.0 of the plugin, but I have tried master and get a different error. For version 0.3.0, my app is crashing on iOS 11 after the user gives permission for the microphone. I see the popup asking for permission to use the microphone, and click OK, and then the app crashes. I see the following log messages in the Xcode console:

-[__NSCFNumber length]: unrecognized selector sent to instance 0xb00000000306c645
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFNumber length]: unrecognized selector sent to instance 0xb00000000306c645'
*** First throw call stack:
(0x182951d04 0x181ba0528 0x18295f1c8 0x1829576b0 0x18283d01c 0x1830b5328 0x182f99608 0x182f30eb8 0x1012e6d2c 0x1012e1d30 0x1012e30b0 0x1012e2da4 0x1012e1bcc 0x1012b5518 0x1012e9830 0x1012dd088 0x1019a549c 0x1019a545c 0x1019b4280 0x1019a89a4 0x1019b5104 0x1019bc100 0x18257afd0 0x18257ac20)
libc++abi.dylib: terminating with uncaught exception of type NSException

I have tried quite a few things to pinpoint the problem in the Objective C code, but I don't know Objective C very well. Here is my JavaScript code:

    this.recorder = this.$window.audioinput;
    this.captureConfig = {
        sampleRate: 16000,
        channels: this.recorder ? this.recorder.CHANNELS.MONO : null,
        format: this.recorder ? this.recorder.FORMAT.PCM_16BIT : null,
        audioSourceType: this.recorder ? this.recorder.AUDIOSOURCE_TYPE.DEFAULT : null
    };
    this.recorder.start(this.captureConfig);

It took a while, but after further investigation, I determined the app crash was caused by a different Cordova plugin. I was thrown off because the crash happened after clicking OK for microphone permission.

commented

Thanks for the update, @swhile and I’m glad that you identified the source of the issue.