iOS OpenAL和静音开关 [英] IOS OpenAL and silent switch

查看:221
本文介绍了iOS OpenAL和静音开关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用4.3.2 IOS和OpenAL,看来它并不在乎静音开关. (虽然它可以与以前的IOS版本很好地配合使用)

I'm using 4.3.2 IOS and OpenAL and it seems that it doesn't care about the silent switch. (while it was working nicely with previous IOS versions)

使用AudioSessionGetProperty来读取"开关状态的窍门是起作用了.因此,我什至无法静音使用代码.

Also the trick using AudioSessionGetProperty to 'read' the switch status is not working anymore. Thus I can't even mute using code.

有任何提示,最近有什么新闻吗?

Any hint, news about it recently?

推荐答案

您仍然可以使用编程方法来获取静音开关状态,但是您需要确保以下几点:

You can still use programmatic approaches to get the mute switch state, however there's one thing you need to be sure about:

将您的AVAudioSession设置为Ambient!例如,如果将其设置为播放",则不会在意静音开关状态!

set your AVAudioSession to Ambient! If you set it to Playback for example, that will not care about the mute switch state!

您可以像这样简单地设置状态:

You can simply set the state like this:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryAmbient error:nil];

要找到一些用于从应用程序内部查询静音开关状态的代码示例,可以找到工作示例

To find some code examples for querying the mute switch state from within your app, you can find working samples here.

与使用Finch for OpenAL时遇到的问题相同.我只是将声音引擎设置为启动Ambient会话,现在我的静音开关正常工作了:

I had the same issue as you had when I was using Finch for OpenAL. I just set the soundengine to initiate an Ambient session and now my mute switch works properly:

[soundEngine activateAudioSessionWithCategory:AVAudioSessionCategoryAmbient];

这篇关于iOS OpenAL和静音开关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆