How to vibrate iPhone while playing music
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.
精彩评论