Use UICollectionView
1) Inefficient way : If you want to play all media simultaneously.
Grid View of mediaplayers.
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:CollectionCell forIndexPath:indexPath];
// get URL
Player *mediaPlayer = [[self playerArray]objectAtIndex:indexPath.row];
NSURL* videoURL = [NSURL URLWithString:mediaPlayer.url];
MPMoviePlayerController* mPlayer = [[MPMoviePlayerController alloc] initWithContentURL:videoURL];
[mPlayer prepareToPlay];
[mPlayer play];
//For viewing partially.....
[mPlayer.view setFrame:CGRectMake(/*Your frame*/)];
[mPlayer.view.backgroundColor = [UIColor grayColor];
[cell addSubview:mPlayer.view];
return cell;
}
2) Efficient way: Place the grid with thumbnails and replace media player object with UIImageview when user taps on a cell (in this case place the above code in didSelectRow )
0
solved How can I overlap videos in my iPhone app? [closed]