简体   繁体   English

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

[英]how to give the two categories in AVAudioSession set category

I am using the "AVAudioSessionCategoryPlayAndRecord" category for the audio session. 我在音频会话中使用“ AVAudioSessionCategoryPlayAndRecord”类别。 But it didn't plays in silent mode. 但是它没有在静音模式下播放。 I need to give "AVAudioSessionCategoryPlayback" also. 我还需要提供“ AVAudioSessionCategoryPlayback”。 But only one can be given. 但是只能给出一个。 I need both categories. 我需要两个类别。 If any one knows the answer please help me. 如果有人知道答案,请帮助我。

From Apple doc - the mode "AVAudioSessionCategoryPlayAndRecord", should play in silent mode. 从Apple Doc-模式“ AVAudioSessionCategoryPlayAndRecord”应在静默模式下播放。 It sounds like this is the only one you need. 听起来这是您唯一需要的一个。 Maybe you missed this note: 也许你错过了这个笔记:

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. 注意:为使您的应用程序在“铃声/静音”开关设置为“无声”且屏幕锁定时继续播放音频,请确保已将UIBackgroundModes音频键添加到应用程序的Info.plist文件中。 This requirement is in addition to your using the correct category. 此要求是您使用正确类别的补充。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法为AVAudioSession设置类别 - Not able to set category for AVAudioSession 为 WKWebview 设置 AVAudioSession 类别 - Set AVAudioSession Category for WKWebview AVAudioSession类别无法按文档要求运行 - AVAudioSession category not working as documentation dictates AVAudioSession 将类别设置为没有选项的播放无法在 AirPods 上播放,同样设置类别没有选项将不会应用媒体信息 - AVAudioSession set category to playback without options fail to Play on AirPods, also set category without options will not apply media info iOS,AVAudioSession和Novocaine:如何动态设置采样率? - IOS, AVAudioSession and Novocaine: how to set the sample rate dynamically? 如何在Objective-C中AVAudioSession的setCategory方法中设置几个选项? - How to set several options in the setCategory method of AVAudioSession in Objective-C? AVAudioSession更改类别冻结AVCapture屏幕 - AVAudioSession Changing Category Freezing AVCapture Screen 是否可以订阅AVAudioSession类别/模式更改的事件? - Is it possible to subscribe to AVAudioSession Category/Mode changed events? 如何阻止Avaudiosession停用? - How to stop Avaudiosession from deactivating? 使用 SFSpeechRecognizer 和 AVSpeechSythesizer 时如何正确设置 AVAudioSession 和 AVAudioEngine - How to correctly set up AVAudioSession and AVAudioEngine when using both SFSpeechRecognizer and AVSpeechSythesizer
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM