Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- NSString *fileName = [[NSBundle mainBundle] pathForResource:@"Alarm" ofType:@"caf"];
- NSURL *url = [[NSURL alloc] initFileURLWithPath:fileName];
- NSLog(@"Test: %@ ", url);
- AVAudioPlayer *audioFile = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:NULL];
- audioFile.delegate = self;
- audioFile.volume = 1;
- [audioFile play];
- // Build URL to the sound file we are going to play
- NSURL *sound_file = [[NSURL alloc] initFileURLWithPath: [[NSBundle mainBundle] pathForResource:sound_file_name ofType:@"mp3" inDirectory:directory]];
- // Play it
- audio_player = [[AVAudioPlayer alloc] initWithContentsOfURL:sound_file error:nil];
- audio_player.delegate = self;
- [audio_player play];
- [sound_file release];
Add Comment
Please, Sign In to add comment