TorIsHere TorIsHere - 15 days ago 6
iOS Question

Skype for business iOS SDK: unable to start audioservice

I am integrating a Skype's iOS SDK and when I try to start audioservice from conversation helper.

do {
try self.conversationHelper.conversation.audioService.start()
}
catch {
print(error.localizedDescription)
}


I got this error. And audio was neither came through nor went out. (But the videoservice was working fine.)

2016-11-12 21:22:00.012 test-skype[669:1aa91fc40] INFO APPLICATION CUcmpAudioModality.cpp:230 CUcmpAudioModality::start(AudioType) called.
2016-11-12 21:22:00.014 test-skype[669:1aa91fc40] INFO APPLICATION CUcmpAudioModality.cpp:259 CUcmpAudioModality::start(AudioType, CUriString) called.
2016-11-12 21:22:00.015 test-skype[669:1aa91fc40] INFO APPLICATION CUcmpAudioVideoModality.cpp:2799 CUcmpAudioModality::queryCapability on StartVoIP returned false because modality state is InConversation
2016-11-12 21:22:00.017 test-skype[669:1aa91fc40] ERROR APPLICATION CUcmpAudioModality.cpp:267 Unable to start audio with error (587726849)


How do I fix this? Please help.

Answer

I manage to find a solution. I need to initialize AVAudioSession and set category to AVAudioSessionCategoryPlayAndRecord first to make it work.

let audioSession: AVAudioSession = AVAudioSession.sharedInstance()
do{
    try audioSession.setCategory(AVAudioSessionCategoryPlayAndRecord)
}
catch let errorForCategory as Error{
    print(errorForCategory.localizedDescription)
}
do{
    try audioSession.setMode(AVAudioSessionModeVoiceChat)
}
catch let errorForMode as NSError{
    print(errorForMode.localizedDescription)
}
Comments