I'm attaching mp4 file, that was recorded using AVCaptureMovieFileOutput
, to notification in UNNotificationServiceExtension
Apparently, video frames is upside down and orientation is specified in metadata
If I open video in notification it's played correctly, but preview is upside down
I've tried specify clipping rect like that
do {
let upsideDown = CGRect(origin: CGPoint(x: 0, y: 1), size: CGSize(width: 1, height: -1))
try bestAttemptContent.attachments = [UNNotificationAttachment(
identifier: UUID().uuidString,
url: localurl!,
options: [
UNNotificationAttachmentOptionsTypeHintKey: kUTTypeMPEG4,
UNNotificationAttachmentOptionsThumbnailClippingRectKey: upsideDown.dictionaryRepresentation,
UNNotificationAttachmentOptionsThumbnailTimeKey: NSNumber(5.0)
]
)]
} catch {
print(error)
}
But this code doesn't display preview at all (however video still works correctly)