如何在播放音乐时振动 iPhone
我尝试在使用 MediaPlayer 框架播放 iPod 音乐时使用 AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) 振动 iPhone,但在播放音乐时无法让振动工作。我可以使用以下代码在播放 iPod 音乐的同时播放声音,但振动似乎不起作用。
[musicPlayerController play]; // play the iPod music
AudioServicesPlaySystemSound(mySoundFileID); // this function works fine -- it plays an aif sound while the music is playing
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); // But this line doesn't do anything!
有人对我有什么建议吗?多谢!
I am trying to vibrate the iPhone using AudioServicesPlaySystemSound(kSystemSoundID_Vibrate) while playing iPod music with the MediaPlayer framework, but I can't get the vibrate to work while the music is playing. I can play a sound at the same time as the iPod music using the following code, but the vibrate doesn't seem to work.
[musicPlayerController play]; // play the iPod music
AudioServicesPlaySystemSound(mySoundFileID); // this function works fine -- it plays an aif sound while the music is playing
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); // But this line doesn't do anything!
Does anyone have any suggestions for me? Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你检查过iphone设置中的声音设置吗?您需要将声音下的振动更改为“开”,以防其关闭。
Have you checked the sound setting in iphone setting? You need to changed vibrate to ON under sounds, in case it turned OFF.