iPhone 播放音频时振动
我的应用程序使用 AudioQueue 和 AudioSession 播放音频。我无法根据应用程序工作流程停止播放。目前,我的客户要求我根据某些条件执行 iPhone 振动。我尝试使用 AudioServices 播放振动作为系统声音或警报声音来执行它。没有积极的结果。有人可以帮助我并告诉我如何实施吗?我正在为未越狱的 iPhone 提出合法申请,并且无法使用自定义 freamworks,因为 Apple 可以拒绝申请。
谢谢。
My application plays audio using AudioQueue and AudioSession. I can't stop playing according to application workflow. Currently, my customer ask me to perform iPhone vibration according to some conditions. I've tried to perform it with AudioServices playing vibration as system sound or alert sound. There is not positive result. Could somebody help me and tell how to implement it? I'm making legal application for non jailbreaked iPhones and can't use custom freamworks because Apple can reject application.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用此解决方案解决了:)
Solved using this solution :)
这就是我获得振动的方式:
#import
希望有帮助
This is how I get the vibration:
#import <AudioToolbox/AudioToolbox.h>
Hope it helps
作为参考,我没有使用
AudioQueue
而是使用AVAudioEngine
来录制某些内容,对于我的情况,我将其确定为必须暂停输入才能播放振动在录制会话期间正确使用AudioServicesPlaySystemSound
。所以就我而言,我做了这样的事情
For reference, I'm not using
AudioQueue
but anAVAudioEngine
to record something, and for my case I pinpointed it down to having to pause the input in order to play the vibration properly withAudioServicesPlaySystemSound
during a record session.So in my case, I did something like this