I've been looking for a while how to play sound on the iphone, and I think it's something along the lines of:
[[NSSound soundNamed:@"cat.mp3"] play];
But the NSSound is on the AppKit ... any suggestions ? I know there is a really simple answer to this, but today my searches are not rendering any result ...
the new AVFoundation class is the easiest way to play sound on the iPhone, though it is for firmware 2.2 only:
AVAudioPlayer *audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] error:NULL];
[audioPlayer play];
you just need this import in the class that uses it:
#import <AVFoundation/AVAudioPlayer.h>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With