Ios 连接耳机时静音
我使用Xamarin的Red5Pro连接到音频广播。声音传到扬声器。一边听,一边连接蓝牙耳机。声音切换到他们,但很安静 对于声音,我将AVAudioSession与以下设置一起使用: 类别-播放和录制 类别选项-默认为Speaker | AllowBluetooth | AllowBluetooth A2DP 并激活会话 设置音频会话代码:Ios 连接耳机时静音,ios,xamarin,audio,avaudiosession,red5pro,Ios,Xamarin,Audio,Avaudiosession,Red5pro,我使用Xamarin的Red5Pro连接到音频广播。声音传到扬声器。一边听,一边连接蓝牙耳机。声音切换到他们,但很安静 对于声音,我将AVAudioSession与以下设置一起使用: 类别-播放和录制 类别选项-默认为Speaker | AllowBluetooth | AllowBluetooth A2DP 并激活会话 设置音频会话代码: private static void SetupAVSession() { AVAudioSession.SharedIn
private static void SetupAVSession()
{
AVAudioSession.SharedInstance().SetActive(false);
AVAudioSession.SharedInstance().SetCategory(AVAudioSessionCategory.PlayAndRecord,
AVAudioSessionCategoryOptions.DefaultToSpeaker | AVAudioSessionCategoryOptions.AllowBluetooth | AVAudioSessionCategoryOptions.AllowBluetoothA2DP);
AVAudioSession.SharedInstance().SetActive(true);
}
我使用值为16000的SetPreferredSampleRate和声音作品
AVAudioSession.SharedInstance().SetPreferredSampleRate(16000, out NSError sampleHardwareErr2);
你也可以发布代码吗?@Isma add init AVAudioSession code