0

プレイリストをストリーミングするために使用しようとしていますが、リスト内のアイテムを表示して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を理解できませんでした

4

1 に答える 1

0

あなたの問題が正確にはわかりませんが、やりたいことは[player insertItem:afterItem:]、プレイリストを動的に変更することです。同様に、removeItemアイテムをプレイリストから動的に削除するために使用します。

まで配列からオブジェクトを削除するにはplayingIndex:

[currentItemArray removeObjectsInRange:NSMakeRange(0,playingIndex)];
于 2013-03-01T12:24:35.093 に答える