使用AVPlayer播放mp3,模拟器中毫无问题,但是真机下无法播放,测试环境是iOS10.3.2,这是什么问题,是少了什么配置吗?
简单的测试代码:
NSURL *url = [NSURL URLWithString:@"http://download.lingyongqian.cn/music/ForElise.mp3"];
AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:url];
_player = [[AVPlayer alloc] initWithPlayerItem:item];
if([[UIDevice currentDevice] systemVersion].intValue>=10){
self.player.automaticallyWaitsToMinimizeStalling = NO;
}
[_player play];