Skip to content

Instantly share code, notes, and snippets.

@Alos
Created September 11, 2011 05:14
Show Gist options
  • Save Alos/1209206 to your computer and use it in GitHub Desktop.
Save Alos/1209206 to your computer and use it in GitHub Desktop.
NSError *error;
audioPlayer = [[[AVAudioPlayer alloc] initWithContentsOfURL:audioFileURL error: &error] autorelease];
audioPlayer.numberOfLoops = -1;
audioPlayer.delegate = self;
audioPlayer.volume = 1.0;
if (audioPlayer == nil)
NSLog(@"%@", [error description]);
else
{
BOOL ready = [audioPlayer prepareToPlay];
if(ready){
[audioPlayer play];
NSLog(@"Should have been played :O");
}else{
NSLog(@"Something is wrong");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment