我正在为 Audio Session 使用“AVAudioSessionCategoryPlayAndRecord”类别。但它没有在静音模式下播放。我还需要提供“AVAudioSessionCategoryPlayback”。但是只能给一个。我需要两个类别。如果有人知道答案,请帮助我。
最佳答案
来自 Apple 文档 - “AVAudioSessionCategoryPlayAndRecord”模式应该以静音模式播放。听起来这是您唯一需要的。 也许您错过了这条注释:
Note: For your app to continue playing audio when the Ring/Silent switch is set to silent and the screen is locked, make sure the UIBackgroundModes audio key has been added to your app’s Info.plist file. This requirement is in addition to your using the correct category.
关于ios - 如何给AVAudioSession中的两个类别设置类别,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33230797/