1

外部 Bluetooth airpod デバイスが airpod マイクを使用してオーディオを録音し、他の Bluetooth デバイスでもフローレスで動作するように、オーディオ セッション カテゴリを設定する方法。これが私のコードです。

AVAudioSession *audioSession = [AVAudioSession sharedInstance];

/*
 optimum to minimize delay, must put a software resampler to deal with 8khz
 */
NSError *error;
[audioSession setPreferredSampleRate:8000.0 error:&error];

if([[UIDevice currentDevice] systemVersion].floatValue>=10.0)
{
    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
                  withOptions:AVAudioSessionCategoryOptionAllowBluetoothA2DP
                        error:&error];
}
else
{
    [audioSession setCategory:AVAudioSessionCategoryPlayAndRecord
                  withOptions:AVAudioSessionCategoryOptionAllowBluetooth
                        error:&error];
}
4

0 に答える 0