IOS播放音乐


NSString *audioPath =[[NSBundle mainBundle]pathForResource:@"aaa" ofType:@"m4a"];
    NSURL *url = [NSURL fileURLWithPath:audioPath];
    NSError *error;
    audioPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
    audioPlayer.numberOfLoops = 1;
    [audioPlayer play];
NSString *audioPath =[[NSBundle mainBundle]pathForResource:@"aaa" ofType:@"m4a"];
    NSURL *url = [NSURL fileURLWithPath:audioPath];
    NSError *error;
    audioPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
    audioPlayer.numberOfLoops = 1;
    [audioPlayer play];

posted @ 2012-12-06 15:29  废弃账号  阅读(66)  评论(0编辑  收藏  举报