1

我使用 Red5Pro for Xamarin 连接到音频投射。声音传到扬声器。在听的时候,我连接了我的蓝牙耳机。声音切换到他们,但很安静。

对于声音,我使用带有设置的 AVAudioSession:

类别- PlayAndRecord

CategoryOptions - DefaultToSpeaker | 允许蓝牙 | 允许蓝牙A2DP

并激活会话

设置 AVAudioSession 代码:

    private static void SetupAVSession()
    {
        AVAudioSession.SharedInstance().SetActive(false);
        AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.PlayAndRecord,
        AVAudioSessionCategoryOptions.DefaultToSpeaker | AVAudioSessionCategoryOptions.AllowBluetooth | AVAudioSessionCategoryOptions.AllowBluetoothA2DP);
        AVAudioSession.SharedInstance().SetActive(true);
    }
4

1 回答 1

1

我使用 SetPreferredSampleRate 值为 16000 并且工作正常

AVAudioSession.SharedInstance().SetPreferredSampleRate(16000, out NSError sampleHardwareErr2);
于 2019-11-28T11:13:42.523 回答