Revision: 41959
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 25, 2011 10:29 by takezou621
Initial Code
- (void) playSoundWithURL: (NSURL*) fileURL{
NSError *error = nil;
AVAudioPlayer *player =
[[AVAudioPlayer alloc] initWithContentsOfURL: fileURL
error: &error];
if(error){
NSLog(@"error = %@",error);
NSLog(@"[error code] = %d",[error code]);
return;
}
player.delegate = self;
[player play];
}
-(void) audioPlayerDidFinishPlaying: (AVAudioPlayer *)player successfully:(BOOL) flag{
[player release];
}
// 呼ã²ã‚™å‡ºã—
-(void) viewDidLoad{
NSString *path = [[NSBundle mainBundle] pathForResource:@"pad"
ofType:@"aif"];
NSURL *fileURL = [NSURL fileURLWithPath:path];
[self playSoundWithURL:fileURL];
}
Initial URL
Initial Description
Initial Title
AVFoundation サンプル
Initial Tags
Initial Language
Objective C