开发者

How to vibrate iPhone while playing music

开发者 https://www.devze.com 2023-01-06 17:42 出处:网络
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 mus

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);    // 开发者_如何学JAVAthis 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!


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

0

精彩评论

暂无评论...
验证码 换一张
取 消