fix #5 camera video preview with settling and diagnostics
iOS CI / Build and Test SwiftUI App (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build Unsigned iOS IPA (push) Canceled after 0s
Build Unsigned iOS and macOS Apps / Build macOS ZIP (push) Canceled after 0s

- Wait until the picker movie's file size stops changing before
  staging it, so a movie whose final bytes are still being flushed is
  never copied truncated (which produced drafts without a thumbnail
  and unplayable previews).
- Log the whole camera video path (pickup size, staging result,
  analyze outcome, thumbnail decode) under the video-preview os_log
  category for fast on-device diagnosis.
- Cover the video analysis pipeline with a simulator test that
  generates an HEVC QuickTime movie and asserts duration plus JPEG
  thumbnail, and guard the diagnostics in Scripts/verify.sh.
This commit is contained in:
wt committed 2026-08-29 04:30:40 +07:00
1 parent 75fbcc5346
commit 496ee6f0f2
7 files changed
+137 -5

No files matched your search

@@ -1,6 +1,7 @@
import AVFoundation
import Foundation
import ImageIO
import os
import UniformTypeIdentifiers
actor MediaPreviewProcessor {
@@ -44,6 +45,12 @@ actor MediaPreviewProcessor {
}
let waveform = kind == .voice ? voiceWaveform(for: url) : nil
if kind == .video {
let logger = Logger(subsystem: "Luma", category: "video-preview")
logger.info(
"analyze video: \(url.lastPathComponent) duration=\(String(describing: duration)) thumbnailBytes=\(thumbnailData?.count ?? 0)"
)
}
return Analysis(
duration: duration,
thumbnailData: thumbnailData,
@@ -94,6 +101,8 @@ actor MediaPreviewProcessor {
return data
}
} catch {
Logger(subsystem: "Luma", category: "video-preview")
.error("image generator failed at \(second)s: \(error.localizedDescription)")
continue
}
}