0
line inループを使用して別の配列のAVPlayerItem
オブジェクトの配列を作成します。これは単一の項目では機能しますが、配列全体では機能しません。iOS - AVQueuePlayer initwithitems()を使用できません
MPMediaQuery *albumQuery = [MPMediaQuery albumsQuery];
MPMediaPropertyPredicate *albumPredicate = [MPMediaPropertyPredicate predicateWithValue:@"Out Of Exile" forProperty:MPMediaItemPropertyAlbumTitle];
[albumQuery addFilterPredicate:albumPredicate];
NSArray *songs = [albumQuery items];
NSMutableArray <AVPlayerItem*> *items;
NSUInteger i = 0;
while(i < [songs count]){
AVPlayerItem *playerItem = [[AVPlayerItem alloc] initWithURL:[[songs objectAtIndex:i] valueForProperty:MPMediaItemPropertyAssetURL]];
[items addObject:playerItem];
i++;
}
AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:[[songs objectAtIndex:index] valueForProperty:MPMediaItemPropertyAssetURL]]; //manually created item which works
_player = [[AVQueuePlayer alloc] initWithItems:items];
[_player play];
だから、私の問題は、私はきちんとして、配列AVQueuePlayer
を初期化することができないということであり、それは私が怒っ駆動です。 InitWithPlayerItem
で初期化し、作成したアイテムを追加すると機能しますが、アイテム配列のオブジェクトでは機能しません。
InitWithItems:items[index*]
を呼び出しても、何も起こりません。