birdofpreyru/react-native-audio

[iOS] Input / output device selection

Closed this issue · 3 comments

Right now, when sound recording is activated on iOS, in the following codeblock, we do nothing to select audio device:

[self handleStatus:AudioQueueNewInput(&config, HandleInputBuffer,
(__bridge void*)self,
NULL, NULL, 0, &queue)];
for (int i = 0; i < NUM_BUFFERS; ++i) {
[self handleStatus:AudioQueueAllocateBuffer(queue, bufferSize, &buffers[i])];
[self handleStatus:AudioQueueEnqueueBuffer(queue, buffers[i], 0, NULL)];
}
[self handleStatus:AudioQueueStart(queue, NULL)];

It turns out, when external (e.g. bluetooth microphone / headphone) audio device is connected to iOS device, even if initially the sound from the app is output to that device, entering into Tuning (or interactive training mode), and activating sound recording, currently switches both audio input and output to the default (on-board of device) iOS speaker / mic. This happens inside this call.

Now, the problem is after a brief investigation I am not able to find how to select the audio input / output device (can't see such config in the docs of the methods we use in the codeblock linked above). It seems it might not possible to use input and output from different devices on iOS (not without user re-configuration of audio settings inside device configs), but we at least should instruct the app to keep using bluetooth mic/speaker, if they are connected and used before activating sound recording.

It requires further investigation, how to achieve it.

  • configAudioSystem() feature added in v1.2.2 allows to ensure the bluetooth device is used for output, if connected, thus probably no more action needed for this ticket.