Professional Documents
Culture Documents
#import <UIKit/UIKit.h>
#import <AudioToolbox/AudioToolbox.h>
#import <AVFoundation/AVFoundation.h>
@interface MusicPlayiPadViewController : UIViewController
<AVAudioPlayerDelegate> { SystemSoundID systemSoundID;
AVAudioPlayer *player; UIButton *StartStopSound;}
- (void)viewDidLoad {
- (void)viewDidLoad {
NSLog(@"InView did load");
AudioServicesCreateSystemSoundID((CFURLRef)[NSURL
fileURLWithPath:[[NSBundle mainBundle] pathForResource: @"sound"
ofType:@"aif"]], &systemSoundID);
player = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL
fileURLWithPath: [[NSBundle mainBundle] pathForResource:@"music"
ofType:@"mp3"]] error:nil];
[player prepareToPlay];