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

View File

@ -118,16 +118,12 @@ export interface CameraDeviceFormat {
photoWidth: number;
/**
* The video resolutions's height
*
* @platform iOS 13.0
*/
videoHeight?: number;
videoHeight: number;
/**
* 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.
*