Skip to content

Commit

Permalink
Fix multi-cam support
Browse files Browse the repository at this point in the history
  • Loading branch information
davidliu committed Oct 14, 2024
1 parent b3e537b commit f35249a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ios/RCTWebRTC/VideoCaptureController.m
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ - (AVCaptureDeviceFormat *)selectFormatForDevice:(AVCaptureDevice *)device
int currentDiff = INT_MAX;

for (AVCaptureDeviceFormat *format in formats) {
// Only use multi cam formats when on multi cam supported devices.
if (@available(iOS 13.0, macOS 14.0, tvOS 17.0, *)) {
if (AVCaptureMultiCamSession.multiCamSupported && !format.multiCamSupported) {
continue;
}
}

CMVideoDimensions dimension = CMVideoFormatDescriptionGetDimensions(format.formatDescription);
FourCharCode pixelFormat = CMFormatDescriptionGetMediaSubType(format.formatDescription);
int diff = abs(targetWidth - dimension.width) + abs(targetHeight - dimension.height);
Expand Down Expand Up @@ -252,4 +259,4 @@ - (void)resetFrameRateForDevice:(AVCaptureDevice *)device {

@end

#endif
#endif

0 comments on commit f35249a

Please sign in to comment.