Video in der Sammlungsansichtszelle abspielen wie die Videos in der Facebook-App Timeline

Ich möchte Videos in der Zelle der Sammlungsansicht wiedergeben. Die Anforderung entspricht der Zeitleiste des Instagram-Diagramms, und das Wiedergeben von Videos entspricht dem Wiedergeben von Videos in der Facebook-Zeitleiste.

azu habe ich UICollectionViewCell verwendet. Ich habe einige Bilder, keine Videos. Ich bin Bilder aus der Galerie. Ich mache das Bild mit der Kamera und ich nehme das Video auf, jedes Mal, wenn ich eines von dem oben genannten und dem ausgegebenen habe Ich habe auf die Zeitleiste hinzufügen.

Zum Beispiel nehmen wir 3vc 1. vc hat eine Sammlungsansicht mit einigen Bildern, ich die zweite vc, die wir ausgegeben bekommen, entweder es ist Video, Bilder, ich nehme die Bilder und das erste Bild in das gemeinsame Array, das ist in der VC3 von VC3 Ich übergebe das Array und die Ausgabe-Video-Pfad-URL an die 1stVC mit Notification Center

 - (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];

}];

und in der 1.VC rufe ich sie wie folgt ab

[[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];

- (void) receiveArray: (NSNotification *) Benachrichtigung

    NSMutableArray* userInfo = notification.object;
UIImage *image = [userInfo firstObject];


if ([userInfo count]>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;

}

- (void) receivetitleArray: (NSNotification *) Benachrichtigung

    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];

} - (void) sharevideooutputurl: (NSNotification *) Benachrichtigung

NSURL *finalsharevideourl=notification.object;

[self.collection reloadData];
_collection.delegate=self;
_collection.dataSource=self;

}

und In der Sammlung viewcell

  - (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;

} Das erste Einzelbild von Bild und Video wird erfolgreich hinzugefügt. Ich möchte auch Videos abspielen, wenn ich scrolle. Wenn der Indexpfad ein Video enthält, das das Video automatisch in der Zelle abgespielt hat, habe ich in dieser URL "finalsharevideourl" den vollständigen Pfad.

Ich bin neu in der Zielsetzung c, einige helfen mir bitte, Danke für die schnelle Antwort

Antworten auf die Frage(2)

Ihre Antwort auf die Frage