Last active
August 29, 2015 14:05
-
-
Save ghvillasboas/241b556d0510a4e02ca7 to your computer and use it in GitHub Desktop.
iOS Audio Playback
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// vibrate | |
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); | |
// play short sound (< 30s) | |
SystemSoundID beep; | |
// Create the sound ID | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"caf"]; | |
NSURL *url = [NSURL fileURLWithPath:path]; | |
AudioServicesCreateSystemSoundID((__bridge CFURLRef)url, &beep); | |
// play it! | |
AudioServicesPlaySystemSound(beep); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment