pbakondy / cordova-plugin-speechrecognition

:microphone: Cordova Plugin for Speech Recognition
MIT License
197 stars 117 forks source link

I cannot use microphone with Airpod Pro on iOS #116

Open khdavidkim opened 3 years ago

khdavidkim commented 3 years ago

I changed code (AVAudioSessionCategoryPlayAndRecord -> AVAudioSessionCategoryRecord) on 84line at SpeechRecognitoin.m.

[audioSession setCategory:AVAudioSessionCategoryRecord withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];

kidGodzilla commented 3 years ago

Just a note:

I applied this change to a local version of the plugin, where I used this to transcribe spoken audio recorded via cordova-plugin-media.

This change solved a problem for me, where audio playback volume was getting stuck at around 25% (I suspect earphone levels), after recording, and could not be adjusted.

I'm not familiar with the implications of this change in Objective-C but it appears to work on my end with no adverse side effects.

Repro scenario:

AirPods pro are paired but not connected (in case).

  1. play audio,
  2. volume is OK.
  3. Initiate recording,
  4. initiate transcription,
  5. stop recording,
  6. stop transcription,
  7. audio is stuck at earphone levels