2010-07-08 5 views
0

여기에 사운드 재생 내 코드입니다 :아이폰 사운드를 재생하며 진동 문제

NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Feel" ofType:@"mp3"]; 
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath:filePath]; 
AVAudioPlayer *_audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:fileURL error:nil]; 
[_audioPlayer prepareToPlay]; 
_audioPlayer.numberOfLoops = -1; 
[fileURL release]; 
_audioPlayer.currentTime = 0; 
[_audioPlayer play]; 

내 문제는이 소리를 재생하는 동안 진동하는 방법이다는?

답변

1

진동의 경우에는 "System Sound Services Reference"설명서, 특히 AudioServicesPlaySystemSound() 메서드를 상수 kSystemSoundID_Vibrate와 함께 읽으십시오.

프로젝트를 AudioToolbox 프레임 워크에 연결하는 것을 잊지 마십시오.

+0

이것은 2-3 초간 진동합니다. 연속체를 재생할 수있는 방법이 있습니까? –

+0

콜백을 등록하고 함수를 다시 호출해야합니까? –

+0

조심하십시오. 지속적인 진동은 거부의 잠재적 원인입니다. Cf. http://stackoverflow.com/questions/308479/reasons-for-rejecting-iphone-application-by-apple-store – Guillaume