Post

Replies

Boosts

Views

Activity

Failure to set AVAudioSession category from background routes audio to random ports, iOS 16
We have a VOIP application. We are setting AudioSession category on appLaunch. Need to support A2Dp profiles. do { try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .spokenAudio, options: [.mixWithOthers, .allowBluetooth, .allowBluetoothA2DP, .duckOthers]) try AVAudioSession.sharedInstance().setActive(true) MCXLogVerbose("[Audio] [App] AVAudioSession activation to playAndRecord SUCCESSFUL") } catch { MCXLogVerbose("[Audio] [App] AVAudioSession activation to playAndRecord FAILED") } We also have a framework which handles everything regarding networking, audio capturing, transmission etc. Apart from the application side, we also need to change category according to necessities. Everything works fine while application is in foreground. But in background state. it seems category can't be set. ERROR: "AVAudioSession.ErrorCode.cannotInterruptOthers", meaning another session is active(i guess). But i could not find any. As a result, incoming audio sometimes plays at receiver or speaker or airpod randomly, after a single failure. We are trying to switch category between playAndrecord and playback. do { try AVAudioSession.sharedInstance().setCategory(.playback, mode: .spokenAudio, options: [.mixWithOthers, .duckOthers]) try AVAudioSession.sharedInstance().setActive(true) MCXLogVerbose("[Audio] [App] AVAudioSession activation to playback SUCCESSFUL") } catch { MCXLogVerbose("[Audio] [App] AVAudioSession activation to playback FAILED") } ** Few confusions here, Why does it not fail while in foreground? Why simple straightforward demo application can set category from background without any failure? It seems iOS15 doesn't create audio routing errors even if session had failed to change its category. Whats changed? Am i missing any subtle steps to follow? Also airplay shows wrong port as selected. **
0
1
1.7k
Feb ’23
PushToTalk Framework: requesting clarifications
Hi, We have already developed a PTT app and it uses PTT entitlement for VOIP APNS. I am having some difficulties understanding how to integrate the pushToTalk framework. It would be very helpful if you kindly clarify my concerns. How will I get a channel UUID? When will it be created? Are the channel and session same? Suppose group A is active, and a high priority group B call comes in between, will group A channel be interrupted? How this scenario will be handled? I am assuming that, in the case of an incoming call, APNS will go to each participant of a channel, but to create an audio session and transmission, I will still need to communicate with my own server explicitly. Can you please share the detailed process?
1
1
1.4k
Aug ’22