2011-06-07 40 views

回答

3

难道ü尝试使用

[[AVAudioPlayer alloc]initWithContentsOfURL:fileUrl error:nil]; 

播放文件

1

下面是一个完整的示例部分。

myClass.h:

- @interface myClass : NSObject \<AVAudioPlayerDelegate\> ... 

myClass.m:

localPlayer = [[AVAudioPlayer alloc] 
    initWithContentsOfURL:newAudioURL error:nil]; [localPlayer 
    setDelegate:self]; 

    - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer *)playedPlayer successfully:(BOOL)flag { 
     NSLog(@"releasing"); 
     [playedPlayer release]; 
     NSLog(@"released"); }