mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-17 11:08:06 +00:00
use new api configure audio session
This commit is contained in:
parent
7f436ecf40
commit
b5df5110d3
2 changed files with 2 additions and 13 deletions
|
|
@ -332,18 +332,6 @@ import AVFoundation
|
|||
providerDelegate.uuids.removeAll()
|
||||
}
|
||||
|
||||
// To be removed.
|
||||
static func configAudioSession(audioSession: AVAudioSession) {
|
||||
do {
|
||||
try audioSession.setCategory(AVAudioSession.Category.playAndRecord, mode: AVAudioSession.Mode.voiceChat, options: AVAudioSession.CategoryOptions(rawValue: AVAudioSession.CategoryOptions.allowBluetooth.rawValue | AVAudioSession.CategoryOptions.allowBluetoothA2DP.rawValue))
|
||||
try audioSession.setMode(AVAudioSession.Mode.voiceChat)
|
||||
try audioSession.setPreferredSampleRate(48000.0)
|
||||
try AVAudioSession.sharedInstance().setActive(true, options: [])
|
||||
} catch {
|
||||
Log.directLog(BCTBX_LOG_WARNING, text: "CallKit: Unable to config audio session because : \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
@objc func terminateCall(call: OpaquePointer?) {
|
||||
if (call == nil) {
|
||||
Log.directLog(BCTBX_LOG_ERROR, text: "Can not terminate null call!")
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@ extension ProviderDelegate: CXProviderDelegate {
|
|||
Log.directLog(BCTBX_LOG_MESSAGE, text: "CallKit: answer call with call-id: \(String(describing: callId)) and UUID: \(uuid.description).")
|
||||
|
||||
let call = CallManager.instance().callByCallId(callId: callId)
|
||||
CallManager.instance().lc?.configureAudioSession()
|
||||
if (call == nil || call?.state != Call.State.IncomingReceived) {
|
||||
// The application is not yet registered or the call is not yet received, mark the call as accepted. The audio session must be configured here.
|
||||
CallManager.configAudioSession(audioSession: AVAudioSession.sharedInstance())
|
||||
callInfo?.accepted = true
|
||||
callInfos.updateValue(callInfo!, forKey: uuid)
|
||||
CallManager.instance().providerDelegate.endCallNotExist(uuid: uuid, timeout: .now() + 10)
|
||||
|
|
@ -242,6 +242,7 @@ extension ProviderDelegate: CXProviderDelegate {
|
|||
action.fail()
|
||||
}
|
||||
|
||||
CallManager.instance().lc?.configureAudioSession()
|
||||
try CallManager.instance().doCall(addr: addr!, isSas: callInfo?.sasEnabled ?? false)
|
||||
} catch {
|
||||
Log.directLog(BCTBX_LOG_ERROR, text: "CallKit: Call started failed because \(error)")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue