feat: Support setting videoStabilizationMode
(#2160)
* feat: Support setting `videoStabilizationMode` * fix: Use `outputs` * Format * Set Video Stabilization Mode
This commit is contained in:
@@ -39,6 +39,8 @@ extension AVCaptureOutput {
|
||||
let cameraOrientation = orientation.rotateBy(orientation: .landscapeLeft)
|
||||
let degrees = cameraOrientation.toDegrees()
|
||||
|
||||
// TODO: Don't rotate the video output because it adds overhead. Instead just use EXIF flags for the .mp4 file if recording.
|
||||
// Does that work when we flip the camera?
|
||||
if connection.isVideoRotationAngleSupported(degrees) {
|
||||
connection.videoRotationAngle = degrees
|
||||
}
|
||||
|
@@ -1,28 +0,0 @@
|
||||
//
|
||||
// AVCaptureSession+setVideoStabilizationMode.swift
|
||||
// VisionCamera
|
||||
//
|
||||
// Created by Marc Rousavy on 02.06.21.
|
||||
// Copyright © 2021 Facebook. All rights reserved.
|
||||
//
|
||||
|
||||
import AVFoundation
|
||||
import Foundation
|
||||
|
||||
extension AVCaptureSession {
|
||||
/**
|
||||
Set the given video stabilization mode for all capture connections.
|
||||
*/
|
||||
func setVideoStabilizationMode(_ mode: String) {
|
||||
if #available(iOS 13.0, *) {
|
||||
guard let mode = try? AVCaptureVideoStabilizationMode(withString: mode) else {
|
||||
return
|
||||
}
|
||||
connections.forEach { connection in
|
||||
if connection.isVideoStabilizationSupported {
|
||||
connection.preferredVideoStabilizationMode = mode
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user