내가 VOIP 통화를 위해 PJSIP를 사용하여 아이폰 OS 응용 프로그램을 설계하고, 마이크가 있지만 스피커 버튼을 누른 후 스피커에서 다시들을 수 없습니다.스피커/VOIP 통화 중 정상 마이크 프로그래밍 방식으로 아이폰 OS 10 신속한 나는 스피커에 전화를 시작하고 버튼을 눌러에 내가 정상에 전화를 걸 수 있어요 <p></p>
내가 그 기능을 달성하기 위해 다음 코드를 사용했다 : -
if sender.titleLabel?.text == "Speaker"{
do {
try audioSession.overrideOutputAudioPort(.none)
try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try audioSession.setMode(AVAudioSessionModeVoiceChat)
try audioSession.setActive(true)
} catch {
print("AVAudioSession cannot be set: \(error)")
}
}else{
do {
try audioSession.overrideOutputAudioPort(.speaker)
try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
try audioSession.setMode(AVAudioSessionModeVoiceChat)
try audioSession.setActive(true)
} catch {
print("AVAudioSession cannot be set: \(error)")
}
}