0
我需要实现iPhone音箱(耳朵和底部)的音频通话过程中的变化(使用TwilioVideo SDK连接)更改设备 矿代码:的iOS扬声器
let audioSession = AVAudioSession.sharedInstance()
do {
if isSpeaker == false {
try audioSession.overrideOutputAudioPort(.speaker)
isSpeaker = true
} else {
try audioSession.overrideOutputAudioPort(.none)
isSpeaker = false
}
try audioSession.setActive(true)
} catch {
handleError(error.localizedDescription)
}
这工作没有任何异常,但不要” t改变音频输出扬声器
这很好,谢谢。 但是有什么方法可以将类别设置为Twilio库中的audioSession? – Viktor
四种可用输出设置为:TVIAudioOutputVideoChatDefault,TVIAudioOutputVideoChatSpeaker,TVIAudioOutputVoiceChatDefault和TVIAudioOutputVoiceChatSpeaker。 – philnash
我的意思是AVAudioSessionCategoryPlayAndRecord类别。我需要显示绿色的通话状态栏,根据https://stackoverflow.com/a/31704318/4899912,我需要将此类别设置为AVAudioSession。将其设置为sharedInstance并没有帮助 – Viktor