How to increase volume of sound recorded using AVAudioRecorder

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 06:13:10

When recording audio, set the audio session to AVAudioSessionCategoryPlayAndRecord or just AVAudioSessionCategoryRecord. When you're done, set it back to just AVAudioSessionCategoryPlayback.

Solution for iOS 12 + Swift 5.0:

  • When starting recording use:

    recordingSession.setCategory(.record) // recordingSession is of type AVAudioSession

  • When playing the record audio use:

    recordingSession.setCategory(.playback)

Note: Place the statements into a do-catch block.

Ankur Sharma

you can try AVaudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSessionPortOverride.Speaker) this is because your output device set to inbuilt speaker in iPhone. while iTab have only speaker so no problem occurs.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!