I have an application which collects the video assets of a users camera roll, using the Photos Framework and methods requestImage & requestAVAsset
I'm allowing the user to share the asset using the UIActivityViewController class and the URL from the AVAsset. My problem is that for some strange reason it won't allow me to share the video.
On the app the error message I get on the UIActivityViewController is
The item cannot be shared. Please select a different item.
Any pointers or advise is appreciated, thanks!
Here is how I present the UIActivityViewController:
let selectedVideo = self.selectedVideo //(AVAsset)
let videoURLPath = selectedVideo.url // URL
DispatchQueue.main.async {
let activityItems: [Any] = [videoURLPath]
let activityViewController = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivity.ActivityType.addToReadingList, UIActivity.ActivityType.airDrop, UIActivity.ActivityType.assignToContact,]
activityViewController.popoverPresentationController?.sourceView = self.view
activityViewController.popoverPresentationController?.sourceRect = self.view.frame
self.present(activityViewController, animated: true, completion: nil)
}
Here's how the video URL looks:
file:///var/mobile/Media/DCIM/107APPLE/IMG_7966.MP4