Merge branch 'video' into carplay

This commit is contained in:
leminlimez committed 2025-06-21 16:45:40 -04:00
commit aac867c83a
1 file changed
+12 -10
+12 -10
View File
@@ -140,17 +140,19 @@ class VideoHandler {
while let sampleBuffer = readerOutput.copyNextSampleBuffer(), while let sampleBuffer = readerOutput.copyNextSampleBuffer(),
let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) { let imageBuffer = CMSampleBufferGetImageBuffer(sampleBuffer) {
let name = "\(frameCount).jpg" try? autoreleasepool {
let filePathName = "assets/\(name)" let name = "\(frameCount).jpg"
UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName)) let filePathName = "assets/\(name)"
UIApplication.shared.change(title: NSLocalizedString("Generating Video...", comment: ""), body: String(format: NSLocalizedString("Creating %@...", comment: "the message for the current image that is being generated"), filePathName))
let ciImage = CIImage(cvPixelBuffer: imageBuffer) let ciImage = CIImage(cvPixelBuffer: imageBuffer)
let context = CIContext() let context = CIContext()
if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) { if let cgImage = context.createCGImage(ciImage, from: ciImage.extent) {
if let img = cgImage.jpg { if let img = cgImage.jpg {
try img.write(to: assetsFolder.appendingPathComponent(name)) try img.write(to: assetsFolder.appendingPathComponent(name))
camlData += "\t\t\t<CGImage src=\"assets/\(name)\"/>\n" camlData += "\t\t\t<CGImage src=\"assets/\(name)\"/>\n"
frameCount += 1 frameCount += 1
}
} }
} }
} }