我正在尝试使用AVQueuePlayer流式传输播放列表,并希望能够从显示列表中项目的UITableView中选择歌曲。
我尝试在每次选择一个项目时重新加载播放器,但是我得到了An AVPlayerItem cannot be associated with more than one instance of AVPlayer
itemArray是完整的项目列表。表项clicked = playIndex.的索引
[player removeAllItems];
player=nil;
NSMutableArray *currentItemArray = [NSMutableArray arrayWithArray:itemArray];
for(int i=0;i<playingIndex; i++)
{
[currentItemArray removeObjectAtIndex:0];
}
player = [[AVQueuePlayer alloc] initWithItems:currentItemArray];
[player play]*还有,有没有更好的方法来删除这些对象而不进行迭代?我搞不懂removeObjectsAtIndexes
发布于 2013-03-01 20:24:35
我不明白你的问题到底是什么,但你想要做的是使用[player insertItem:afterItem:]动态修改播放列表。同样,使用removeItem从播放列表中动态删除项目。
从数组中移除对象直到playingIndex
[currentItemArray removeObjectsInRange:NSMakeRange(0,playingIndex)];https://stackoverflow.com/questions/15157069
复制相似问题