How to construct a valid video URL from the camera roll to share on Twitter without involving the image picker? Our application stores the actual file URL and the localIdentifier for creating the associated PHAsset.
The app implements a custom video library (showing the videos from the camera roll as looped videos), the user can choose a video inside our app and share it on social media. We store the file urls locally in this format:
If I create a videoURL with this format, like:
NSURL* videoURL = [NSURL fileURLWithPath:@"/var/mobile/Media/DCIM/100APPLE/IMG_0249.MP4"]; TWTRComposerViewController* composer = [[TWTRComposerViewController alloc] initWithInitialText:@"Share text" image: nil videoURL:videoURL];
The video will be shared as an image, but not as a video (I wonder if it’s actually a bug, since Twitter SDK is able to find it but not able to see that it’s a video but not an image)
In the official documentation, it says:
The videoURL parameter is required to have format of assets-library. Use key UIImagePickerControllerMediaURL from the didFinishPickingMediaWithInfo: info parameter.
However, when printing the actual URL format, it’s not with the format of asset-library://, but in this format:
Which seems to be only possible to get through the image picker.
How can I create a valid video URL with the actual file URL or the localIdentifier for the PHAsset? Any suggestion would be very appreciated!