feat: Make videoWidth and videoHeight available on all devices

This commit is contained in:
Marc Rousavy 2021-07-08 10:59:27 +02:00
parent b2f3c08a07
commit 5126dd63b4
2 changed files with 8 additions and 8 deletions

View File

@ -22,11 +22,15 @@ extension AVCaptureDevice.Format {
} }
func toDictionary() -> [String: Any] { func toDictionary() -> [String: Any] {
let videoDimensions = CMVideoFormatDescriptionGetDimensions(formatDescription)
var dict: [String: Any] = [ var dict: [String: Any] = [
"videoStabilizationModes": videoStabilizationModes.map(\.descriptor), "videoStabilizationModes": videoStabilizationModes.map(\.descriptor),
"autoFocusSystem": autoFocusSystem.descriptor, "autoFocusSystem": autoFocusSystem.descriptor,
"photoHeight": highResolutionStillImageDimensions.height, "photoHeight": highResolutionStillImageDimensions.height,
"photoWidth": highResolutionStillImageDimensions.width, "photoWidth": highResolutionStillImageDimensions.width,
"videoHeight": videoDimensions.height,
"videoWidth": videoDimensions.width,
"maxISO": maxISO, "maxISO": maxISO,
"minISO": minISO, "minISO": minISO,
"fieldOfView": videoFieldOfView, "fieldOfView": videoFieldOfView,
@ -41,11 +45,11 @@ extension AVCaptureDevice.Format {
] ]
}, },
] ]
if #available(iOS 13.0, *) { if #available(iOS 13.0, *) {
dict["isHighestPhotoQualitySupported"] = self.isHighestPhotoQualitySupported dict["isHighestPhotoQualitySupported"] = self.isHighestPhotoQualitySupported
dict["videoHeight"] = self.formatDescription.presentationDimensions().height
dict["videoWidth"] = self.formatDescription.presentationDimensions().width
} }
return dict return dict
} }
} }

View File

@ -118,16 +118,12 @@ export interface CameraDeviceFormat {
photoWidth: number; photoWidth: number;
/** /**
* The video resolutions's height * The video resolutions's height
*
* @platform iOS 13.0
*/ */
videoHeight?: number; videoHeight: number;
/** /**
* The video resolution's width * The video resolution's width
*
* @platform iOS 13.0
*/ */
videoWidth?: number; videoWidth: number;
/** /**
* A boolean value specifying whether this format supports the highest possible photo quality that can be delivered on the current platform. * A boolean value specifying whether this format supports the highest possible photo quality that can be delivered on the current platform.
* *