Play video in the collection view cell like the videos playing in the Facebook app Timeline
<p>I want to play video in the collection view cell,the requirement is like the instagram timeline  and playing video is like playing videos in the facebook time line,</p>

<p>for this I used UICollectionViewCell in witch I have some images no videos now I am images from gallery,I am taking the image using camera and I am recording the video,every time I will have any one out from  the above and the out put i have add to the time line.</p>

<p>For example, we  take 3vc 1st vc is having collection view with some images,I the second vc we are getting output either it is video,images,I am taking the images and the first frame of the image in to the common array which is in the VC3 from VC3 I am passing the array and the output video path url to the 1stVC using notification center </p>

<pre><code> - (IBAction)sharebuttn:(id)sender {

[self dismissViewControllerAnimated:YES completion:^{

    //  Tabbar index

    [[NSNotificationCenter defaultCenter] postNotificationName:@"ShareArray" object:_selectedimgarray];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"SharetitleArray" object:_newtile];
    [[NSNotificationCenter defaultCenter] postNotificationName:@"sharevideooutputurl" object:_finalvideourl];

}];
</code></pre>

<p>and In the 1stVC I am retrieving them like this </p>

<pre><code>[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedArray:) name:@"ShareArray" object:nil];


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(receivedtitleArray:) name:@"SharetitleArray" object:nil];


[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(sharevideooutputurl:) name:@"Sharevideourl" object:nil];
</code></pre>

<p>-(void) receivedArray:(NSNotification*)notification
{</p>

<pre><code>    NSMutableArray* userInfo = notification.object;
UIImage *image = [userInfo firstObject];


if ([userInfo count]&gt;0) {

     //[_imagearray insertObject:[userInfo firstObject] atIndex:0];
    [app.array1 insertObject:[userInfo firstObject] atIndex:0];
    [self.collection reloadData];
    NSLog(@"%@",app.array1);

}
 //[_imagearray insertObject:[userInfo firstObject] atIndex:0];

 // [self.collection reloadData];
_collection.delegate=self;
_collection.dataSource=self;
</code></pre>

<p>}</p>

<p>-(void) receivedtitleArray:(NSNotification*)notification
{</p>

<pre><code>    NSMutableArray* userInfotitle = notification.object;
NSLog(@"%@",userInfotitle);
//[_tittlearray insertObject:[userInfotitle firstObject] atIndex:0];

 [app.tarray1 insertObject:[userInfotitle firstObject] atIndex:0];
 NSLog(@"%@",app.tarray1);
//NSLog(@"%@",_tittlearray);



_collection.delegate=self;
_collection.dataSource=self;    

[self.tabBarController setSelectedIndex:0];


     //[self.collection reloadData];
</code></pre>

<p>}
-(void) sharevideooutputurl:(NSNotification*)notification
{</p>

<pre><code>NSURL *finalsharevideourl=notification.object;

[self.collection reloadData];
_collection.delegate=self;
_collection.dataSource=self;
</code></pre>

<p>}</p>

<p>and In the collection viewcell </p>

<pre><code>  - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {

 //[self.collection reloadData];
homeceeCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath];


UIImage *image;
NSInteger row = [indexPath row];


NSLog(@"indexpath = %ld", (long)row);
 if( [app.array1[row] isKindOfClass:[UIImage class]]) {
   image= app.array1[row];
}
 else
 {
    image = [UIImage imageNamed:app.array1[row]];

}
cell.img.image = image;

cell.text.text=[app.tarray1 objectAtIndex:indexPath.row];


    return cell;
</code></pre>

<p>}
Image and video first frame image  is adding successfully I want to video also,when i scroll If the indexpath having any video contant the video have play automatically in the cell, in this url "finalsharevideourl "I have complete path </p>

<p>I am new to the objective c,some please help me out,Thanks for the quick responce </p>