3

I make a collection view from images. Now I want to make that collection view from videos. But I cannot solve the problem.

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell=[collectionView dequeueReusableCellWithReuseIdentifier:@"cellIdentifier" forIndexPath:indexPath];

//It shows images in collection view
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[imageFileNames objectAtIndex:indexPath.row]]];

//It does not shows videos in collection view
cell.backgroundView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[videoFileNames objectAtIndex:indexPath.row]]];

}
smottt
  • 3,272
  • 11
  • 37
  • 44
  • What does your array videoFileNames contain? – Deepak Khiwani Mar 25 '15 at 07:02
  • 2
    I assume you don' have video thumbnails in your server. So, you need to first create thumbnail of each video. Check this: [Getting a thumbnail of a *.mov video IOS](http://stackoverflow.com/questions/19530800/getting-a-thumbnail-of-a-mov-video-ios) and [Getting thumbnail from a video url or data in IPhone SDK](http://stackoverflow.com/questions/1347562/getting-thumbnail-from-a-video-url-or-data-in-iphone-sdk) – Bista Mar 25 '15 at 07:04
  • only vedio names..like that 'NSArray *videoFileNames = [NSArray arrayWithObjects:@"nissan1.mp4", @"nissan2.mp4",@"nissan3.mp4", nil];' @Deepk – Md.Ashik Mahmud Mar 25 '15 at 07:05
  • 1
    It won't display in any case..you need to generate thumbnails from your videos and then add those thumbnails to an array then show it in your collection view – Deepak Khiwani Mar 25 '15 at 07:20

0 Answers0