Low recording volume in combination with AVAudioSessionCategoryPlayAndRecord

前端 未结 7 1757
我在风中等你
我在风中等你 2020-12-04 18:30

When I set:

[[AVAudioSession sharedInstance] setCategory:
    AVAudioSessionCategoryPlayAndRecord error:NULL];

…recording and playing works

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-04 18:50

    I ran into this today, and most of the answers don't seem to apply to recent iOS changes. Lucian's answer above with the defaultToSpeaker option is correct, although still seems to behave differently in Simulator and on the device from time to time. What helped for me was to set category, mode and options in one call, which is available in iOS 10+ like this:

    try session.setCategory(AVAudioSessionCategoryPlayAndRecord, mode: AVAudioSessionModeDefault, options: .defaultToSpeaker)
    

    Using this audio was all the way up to maximum and stayed that way.

提交回复
热议问题