I cannot Configure our audio session and begin recording

hi , trying to call begin transmission method by System UI, but I cannot wait for the framework to call this method

 func channelManager(
  _ channelManager: PTChannelManager,
  didActivate audioSession: AVAudioSession
)

If this method cannot callback, I cannot Configure our audio session and begin recording, I don’t know how to that?

Replies

You should configure your AVAudioSession session and set the category to playAndRecord during your initial app start up. Avoid changing your AVAudioSession configuration during the recording process as changing the audio category and mode can introduce significant delay in the recording process. Once the channelManager(_:didActivate:) method is called you can then set up and start your AVAudioEngine to begin recording.

Make sure that you’re doing the following things in your PushToTalk app:

  • Enable the “Audio, AirPlay, and Picture in Picture” and “Push to Talk” background modes in your Xcode project
  • Enable the “Push to Talk” capability in your Xcode project
  • Request or check microphone recording permission when initially setting up the app during launch and not each time you record
  • Set the AVAudioSession category to playAndRecord during initial app start up and do not change it during the recording process. Changing the audio category during the recording process introduces significant delay.
  • We recommend the use of the AVAudioEngine API for the best recording performance