twilio / video-quickstart-ios

Twilio Video Quickstart for iOS
https://www.twilio.com/docs/api/video
MIT License
460 stars 177 forks source link

Audio & mic is not working when incoming call answered from lock screen through call kit #533

Closed madhu-kadyala closed 4 years ago

madhu-kadyala commented 4 years ago

Hi, I'm using Twilio video call in my app. I'm facing issues with call kit when the device was lock state. the receiver can hear the caller's voice and the caller can hear receiver voice during the receiver screen was locked and receiver speaking with default call kit UI. But when the receiver tries to tap on the video button/app btn in call Kit app opening and receiver audio was not working. Both the mic and audio device is not working.

I have called configureAudioSession() function before reporting incoming call

func reportIncomingCallFor(uuid: UUID, handle: String) { let update = CXCallUpdate.init() update.localizedCallerName = handle update.supportsGrouping = false update.supportsUngrouping = false update.supportsDTMF = false update.remoteHandle = CXHandle(type: .generic, value: "Hullo") configureAudioSession() weak var weakSelf = self calProvider!.reportNewIncomingCall(with: uuid, update: update, completion: { (error : Error?) in if let err = error { }else { weakSelf?.currentCall = uuid } }) }

func configureAudioSession() { print("Configuring audio session") let session = AVAudioSession.sharedInstance() do { try session.setCategory(AVAudioSessionCategoryPlayAndRecord) try session.setMode(AVAudioSessionModeVoiceChat) try session.overrideOutputAudioPort(AVAudioSession.PortOverride.none) } catch (let error) { print("Error while configuring audio session: (error)") let log = LagObj() log.message = "Error while configuring audio session: (error)" HulloPayRealm.getInstance().addLogDetails(roomDetails: log) } }

swift version: 4.0

madhu-kadyala commented 4 years ago

I have a live app store release on monday(Jul 27) I have to fix this issue before that. Please anyone help to fix this issue.

ceaglest commented 4 years ago

Hi @madhu-kadyala,

Have you tried comparing to our CallKit example? It demonstrates how and when to hook in CallKit + TwilioVideo in order to manage audio effectively.

func configureAudioSession() {

You shouldn't call into AVAudioSession directly, Twilio Video manages your AVAudioSession for you when you use TVIDefaultAudioDevice. See our guide to working with audio for more information.

Best, Chris

madhu-kadyala commented 4 years ago

Heartly Thank you so much @ceaglest , I have removed configureAudioSession function & disabled audioDevice until get callback from didActivate audioSession. Now It's working fine.