Guest User

Untitled

a guest
Jan 13th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. - (void)playAudioFile:(NSString *)fileName withType:(NSString *)type {
  2. NSString *soundPath = [[NSBundle mainBundle] pathForResource:fileName ofType:type];
  3. AVAudioPlayer *newAudio = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:soundPath isDirectory:NO] error:nil];
  4. self.audioPlayer = newAudio;
  5. [newAudio release];
  6. [audioPlayer setDelegate:self];
  7. audioPlayer.numberOfLoops = 0;
  8. [audioPlayer play];
  9. }
Add Comment
Please, Sign In to add comment