ios - 如何给AVAudioSession中的两个类别设置类别

标签 ios objective-c xcode

我正在为 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/

相关文章:

ios - inputAccessoryView 无法正常工作或格式化

ios - 当我设置图像时 UIImageView 移动或调整大小

ios - "Data is Nil"值来自删除 ios 中的 api 值

iphone - dealloc 从哪里开始?

Xcode 4 : How to set the "continue program execution" key binding?

ios - 重命名 coredata .xcdatamodeld 文件和迁移

ios - 如何以美观实用的方式显示表格数据

ios - 通过 POST 使用 manager.request

objective-c - 如何更改TapkuLibrary日历对象上的事件标记

ios - AVFoundation 条形码扫描器在 iphone 上运行良好但在 Ipad 2 上运行不佳