Search code examples
videoios7uiactivityindicatorview

Sharing Video in io7 via UIactivityViewController


I found out through StackOverflow that in IOS7 its possible to share Video to Facebook, twitter, Youtube.... through UIActivityController. I looked to find if someone has explained how to do it with video and nobody has(from what i found), or at least hasn't done a good job explaining it.

Is there any way to share Video through UIActivityViewController in ios7? It would be preferable if it was possible to choose the video from PhotoLibrary


Solution

  • Not sure about choosing the video from the photo library but this works for sending video from an array

       NSString *videoPath = self.arrayVideoPaths[self.videoIndex];
    
        NSURL *data = [NSURL fileURLWithPath:videoPath];
    
        NSArray *activityItems = [NSArray arrayWithObjects:data, nil];
    
        UIActivityViewController *controller = [[UIActivityViewController alloc] initWithActivityItems:activityItems applicationActivities:nil];
    
        [self presentViewController:controller animated:YES completion:nil];