现在的位置: 首页 > 综合 > 正文

IOS播放音乐

2018年05月25日 ⁄ 综合 ⁄ 共 576字 ⁄ 字号 评论关闭
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];

【上篇】
【下篇】

抱歉!评论已关闭.