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

USB Audio Inputs are not recognized

pvandrunen opened this issue · comments

I thought that I would try this app out to resolve an issue I've found with both iOS and Android, that is USB microphones or USB audio input devices are, in general, not supported in the browser — and therefore my capacitor app.

Reported on iOS (safari) https://bugs.webkit.org/show_bug.cgi?id=211192
Reported for Android (chromium) https://bugs.chromium.org/p/chromium/issues/detail?id=1178521

Unfortunately I have experienced the same behavior with this plugin, on both iOS and Android the plugin only ever captures audio from the mobile devices internal microphone.

I had the impression that in both iOS and Android that the audio device was managed at the os level and so it should just default to the USB audio interface once it is plugged in?

I have tested several USB audio interfaces, they work consistently in native apps such as the iOS "Voice Memos" app and Androids "Recorder" app.

In my use case I am using the event listener to get chunks of audio and sending them off to an API for transcription.

I may be able to sponsor this fix.

function recordInput() {

  window.addEventListener( "audioinput", streamData, false );

  audioinput.start({
    streamToWebAudio: false,
    sampleRate: 16000,
    bufferSize: 8192,
    channels: audioinput.CHANNELS.MONO,
    format: audioinput.FORMAT.PCM_16BIT,
    audioSourceType: audioinput.AUDIOSOURCE_TYPE.DEFAULT,
  });

}