Skip to content

Commit 11bf531

Browse files
authored
Fix multi-cam support (#18)
1 parent b3e537b commit 11bf531

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

ios/RCTWebRTC/VideoCaptureController.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ - (AVCaptureDeviceFormat *)selectFormatForDevice:(AVCaptureDevice *)device
206206
int currentDiff = INT_MAX;
207207

208208
for (AVCaptureDeviceFormat *format in formats) {
209+
// Only use multi cam formats when on multi cam supported devices.
210+
if (@available(iOS 13.0, macOS 14.0, tvOS 17.0, *)) {
211+
if (AVCaptureMultiCamSession.multiCamSupported && !format.multiCamSupported) {
212+
continue;
213+
}
214+
}
215+
209216
CMVideoDimensions dimension = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
210217
FourCharCode pixelFormat = CMFormatDescriptionGetMediaSubType(format.formatDescription);
211218
int diff = abs(targetWidth - dimension.width) + abs(targetHeight - dimension.height);
@@ -252,4 +259,4 @@ - (void)resetFrameRateForDevice:(AVCaptureDevice *)device {
252259

253260
@end
254261

255-
#endif
262+
#endif

0 commit comments

Comments
 (0)