[[AVAudioSession sharedInstance] setcategory:AVAudioSessioncategoryAmbIEnt error:nil];
但是,在静音模式下,我的AVAudioPlayers静音但声音很重要,即使在静音模式下也是如此.我读到有关AudioServicesPlaySystemSound忽略静默模式但它没有,至少在iOS9上没有.
还有其他可能吗?哦,请浪费你的时间说“我会讨厌这个用户”,“不称它为静音模式”,……这是一个编程页面,而不是哲学类.
解决方法 音频会话类别AVAudioSessioncategoryAmbIEnt将遵循文档中所述的Ring / Silent开关 –AVAudioSessioncategoryAmbIEnt
The category for an app in which sound playback is nonprimary—that is,your app can be used successfully with the sound turned off…… Your audio is silenced by screen locking and by the Silent switch (called the Ring/Silent switch on iPhone).
我建议尝试一个更合适的类别与混合选项,如 –
[[AVAudioSession sharedInstance] setcategory:AVAudioSessioncategoryPlayback withOptions:AVAudioSessioncategoryOptionMixWithOthers error:nil];
AVAudioSessioncategoryPlayback类别将忽略文档中提到的静默开关 –
总结When using this category,your app audio continues with the Silent switch set to silent or when the screen locks.
以上是内存溢出为你收集整理的iOS 9以静音模式播放音频,但保持其他应用程序的音乐播放运行全部内容,希望文章能够帮你解决iOS 9以静音模式播放音频,但保持其他应用程序的音乐播放运行所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)