iOS OpenAL 和静音开关
我正在使用 4.3.2 IOS 和 OpenAL,它似乎不关心静音开关。 (虽然它与以前的 IOS 版本配合得很好)
而且使用 AudioSessionGetProperty 来“读取”开关状态的技巧也不再起作用了。因此我什至无法使用代码静音。
最近有什么提示、新闻吗?
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)
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您仍然可以使用编程方法来获取静音开关状态,但是您需要确定一件事:
将 AVAudioSession 设置为 Ambient!例如,如果将其设置为“播放”,则不会关心静音开关状态!
您可以简单地设置状态,如下所示:
要查找一些用于从应用程序内查询静音开关状态的代码示例,您可以找到工作示例 此处。
当我使用 Finch 进行 OpenAL 时,我遇到了与您相同的问题。我刚刚将声音引擎设置为启动 Ambient 会话,现在我的静音开关可以正常工作:
You can still use programmatic approaches to get the mute switch state, however there's one thing you need to be sure about:
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:
To find some code examples for querying the mute switch state from within your app, you can find working samples here.
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: