From abf5538bb0e1e9b86643c493071bcf7b08aebe8a Mon Sep 17 00:00:00 2001 From: Marc Rousavy Date: Wed, 15 Nov 2023 17:00:41 +0100 Subject: [PATCH] feat: Support setting `videoStabilizationMode` (#2160) * feat: Support setting `videoStabilizationMode` * fix: Use `outputs` * Format * Set Video Stabilization Mode --- package/ios/CameraView.swift | 8 +++ package/ios/Core/CameraConfiguration.swift | 9 ++- .../Core/CameraSession+Configuration.swift | 11 ++++ package/ios/Core/CameraSession.swift | 6 +- .../Extensions/AVCaptureOutput+mirror.swift | 2 + ...ureSession+setVideoStabilizationMode.swift | 28 --------- ...ureVideoStabilizationMode+descriptor.swift | 62 ------------------- .../ios/Types/VideoStabilizationMode.swift | 19 ++++++ .../VisionCamera.xcodeproj/project.pbxproj | 8 --- 9 files changed, 53 insertions(+), 100 deletions(-) delete mode 100644 package/ios/Extensions/AVCaptureSession+setVideoStabilizationMode.swift delete mode 100644 package/ios/Parsers/AVCaptureVideoStabilizationMode+descriptor.swift diff --git a/package/ios/CameraView.swift b/package/ios/CameraView.swift index 27b66080a8..7746ee10a7 100644 --- a/package/ios/CameraView.swift +++ b/package/ios/CameraView.swift @@ -185,6 +185,14 @@ public final class CameraView: UIView, CameraSessionDelegate { config.codeScanner = .disabled } + // Video Stabilization + if let jsVideoStabilizationMode = videoStabilizationMode as? String { + let videoStabilizationMode = try VideoStabilizationMode(jsValue: jsVideoStabilizationMode) + config.videoStabilizationMode = videoStabilizationMode + } else { + config.videoStabilizationMode = .off + } + // Orientation if let jsOrientation = orientation as? String { let orientation = try Orientation(jsValue: jsOrientation) diff --git a/package/ios/Core/CameraConfiguration.swift b/package/ios/Core/CameraConfiguration.swift index 60d3f0de01..7be94cf4b5 100644 --- a/package/ios/Core/CameraConfiguration.swift +++ b/package/ios/Core/CameraConfiguration.swift @@ -22,6 +22,9 @@ class CameraConfiguration { var video: OutputConfiguration