如何使 iPhone 的 FMOD 声音在 iPhone 锁定时不暂停?
我正在使用 iPhone 的 FMOD 生成音调并播放它,但是当 iPhone 锁定时声音会暂停。这不是我们想要的行为,而且最近才出现。我已经有一段时间没有测试它了,但我认为自上次以来唯一改变的是我更新到了 iOS 5。
我确保将 FMOD 会话设置为
FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK
并将 AudioSession 类别设置为
kAudioSessionCategory_MediaPlayback
我仔细检查了 AudioSession 和FMOD 文件表明没有任何改变。我还确保我拥有最新版本的 FMOD SDK。任何帮助解决这个问题将不胜感激。
谢谢
I am using FMOD for iPhone to generate a tone and play it, but when the iPhone locks the sound pauses. This is not the desired behavior, and only recently popped up. I hadn't tested it in awhile, but the only thing that I think changed since last time was that I updated to iOS 5.
I made sure to set the FMOD session to
FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK
and the AudioSession category to
kAudioSessionCategory_MediaPlayback
I double checked in both the AudioSession and FMOD documentations that nothing had changed. I also made sure that I had the most recent version of the FMOD SDK. Any help would be appreciated to fix this issue.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
通过 extradriverdata 指定 FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK 应该足以确保在设备锁定时播放音频。我已经在 iOS 5 上对此进行了测试,并且可以确认它确实有效。请注意,这与后台的音频播放是分开的。
我注意到您提到了 kAudioSessionCategory_MediaPlayback 这让我认为您正在使用本机音频会话 API。我强烈建议不要这样做,在 FMOD 之外初始化音频会话可能会导致问题。
我建议删除所有本机音频 API 调用,并在锁定时重新测试音频播放。
It should be sufficient specifying FMOD_IPHONE_SESSIONCATEGORY_MEDIAPLAYBACK via extradriverdata to ensure audio is played while the device is locked. I have tested this with iOS 5 and can confirm it indeed works. Note this is separate from audio playback while in the background.
I've noticed you mentioned kAudioSessionCategory_MediaPlayback which makes me think you are using native audio session APIs. I would highly discourage doing this, initializing the audio session outside of FMOD can cause problems.
I would recommend removing any native audio API calls, and retest audio playback while locked.