如何在播放音乐时振动 iPhone

发布于 2024-09-09 02:24:30 字数 487 浏览 6 评论 0原文

我尝试在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尝蛊 2024-09-16 02:24:30

你检查过iphone设置中的声音设置吗?您需要将声音下的振动更改为“开”,以防其关闭。

Have you checked the sound setting in iphone setting? You need to changed vibrate to ON under sounds, in case it turned OFF.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文