I have a CBL document (synced via SyncGateway) with several attachments. I can easily convert images in UI-Images in Swift, but how can I convert a video from an attachment into a valid video file for iOS (mp4) (with AVFoundation)?
Is there a possibility to access the video directly on the devices file system via URL?
hi @pasin, it says in CBLAttachment.h that contentURL is somewhat deprecated:
/** The (file:) URL of the file containing the contents.
This property is somewhat deprecated and is made available only for use with platform APIs that
require file paths/URLs, e.g. some media playback APIs. Whenever possible, use the `content`
property or the `openContentStream` method instead.
The file must be treated as read-only! DO NOT MODIFY OR DELETE IT.
If the database is encrypted, attachment files are also encrypted and not directly readable,
so this property will return nil. */
@property (readonly, nullable) NSURL* contentURL;
Since attachment needs Data, what I attached is converted video into Data. The attachment looks like this: