UNNotificationAttachment视频预览方向错误

时间:2019-04-18 08:19:15

标签: ios swift unnotificationserviceextension unnotificationattachment

我将使用AVCaptureMovieFileOutput录制的mp4文件附加到UNNotificationServiceExtension的通知中

显然,视频帧是上下颠倒的,并且在元数据中指定了方向

如果我在通知中打开视频,则可以正常播放,但预览是颠倒的

我尝试像这样指定裁剪矩形

    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)
    }

但是此代码根本不显示预览(但是视频仍然可以正常播放)

0 个答案:

没有答案