Skip to content

Commit 5126dd6

Browse files
committed
feat: Make videoWidth and videoHeight available on all devices
1 parent b2f3c08 commit 5126dd6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

ios/Extensions/AVCaptureDevice.Format+toDictionary.swift

+6-2
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,15 @@ extension AVCaptureDevice.Format {
2222
}
2323

2424
func toDictionary() -> [String: Any] {
25+
let videoDimensions = CMVideoFormatDescriptionGetDimensions(formatDescription)
26+
2527
var dict: [String: Any] = [
2628
"videoStabilizationModes": videoStabilizationModes.map(\.descriptor),
2729
"autoFocusSystem": autoFocusSystem.descriptor,
2830
"photoHeight": highResolutionStillImageDimensions.height,
2931
"photoWidth": highResolutionStillImageDimensions.width,
32+
"videoHeight": videoDimensions.height,
33+
"videoWidth": videoDimensions.width,
3034
"maxISO": maxISO,
3135
"minISO": minISO,
3236
"fieldOfView": videoFieldOfView,
@@ -41,11 +45,11 @@ extension AVCaptureDevice.Format {
4145
]
4246
},
4347
]
48+
4449
if #available(iOS 13.0, *) {
4550
dict["isHighestPhotoQualitySupported"] = self.isHighestPhotoQualitySupported
46-
dict["videoHeight"] = self.formatDescription.presentationDimensions().height
47-
dict["videoWidth"] = self.formatDescription.presentationDimensions().width
4851
}
52+
4953
return dict
5054
}
5155
}

src/CameraDevice.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,12 @@ export interface CameraDeviceFormat {
118118
photoWidth: number;
119119
/**
120120
* The video resolutions's height
121-
*
122-
* @platform iOS 13.0
123121
*/
124-
videoHeight?: number;
122+
videoHeight: number;
125123
/**
126124
* The video resolution's width
127-
*
128-
* @platform iOS 13.0
129125
*/
130-
videoWidth?: number;
126+
videoWidth: number;
131127
/**
132128
* A boolean value specifying whether this format supports the highest possible photo quality that can be delivered on the current platform.
133129
*

0 commit comments

Comments
 (0)