Monday 7 January 2013

Audio - Play Sound File

 //Code to play audio from resource
    NSString *path = [NSString stringWithFormat:@"%@%@", [[NSBundle mainBundle] resourcePath], @"/test.wav"];//Replace with your sound file which is in resource file
   
    SystemSoundID soundID;
    NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
    AudioServicesCreateSystemSoundID((CFURLRef)filePath, &soundID);
    AudioServicesPlaySystemSound(soundID);

No comments:

Post a Comment