- (void)prepareMusic:(NSUInteger)index{
if (self.currentIndex != index) {
self.currentIndex = index;
// 获取当前音乐信息
MusicInfo *musicInfo = [self getmusicInfoWithIndext:index];
// 实例化一个PlayerItem作为Player的"CD"
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:[NSURL URLWithString:musicInfo.mp3Url]];
// 替换当前的PlayerItem
[self.player replaceCurrentItemWithPlayerItem:playerItem];
// 安全判断
if ([self.delegate respondsToSelector:@selector(didMusicCutWithMusicInfo:)]) {
[self.delegate didMusicCutWithMusicInfo:musicInfo];
}
}else{
}
}
用户登录
还没有账号?立即注册
用户注册
投稿取消
| 文章分类: |
|
还能输入300字
上传中....
超越时空的想念