Skip to content

Commit 758f4b4

Browse files
authored
NativeCamera - Use the main camera on iOS rather than virtual camera (#1136)
* Use the iOS main camera by default
1 parent 6bb498c commit 758f4b4

File tree

1 file changed

+23
-22
lines changed

1 file changed

+23
-22
lines changed

Plugins/NativeCamera/Source/Apple/NativeCameraImpl.mm

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -205,29 +205,30 @@ fragment float4 fragmentShader(RasterizerData in [[stage_in]],
205205
uint32_t bestPixelCount{0};
206206
uint32_t devicePixelFormat{0};
207207
uint32_t bestDimDiff{0};
208-
NSArray* deviceTypes{nullptr};
208+
NSArray* deviceTypes{@[
209+
// Use the main camera on the device which is best for general use and will typically be 1x optical zoom and the highest resolution.
210+
// https://developer.apple.com/documentation/avfoundation/avcapturedevice/devicetype/2361449-builtinwideanglecamera
211+
AVCaptureDeviceTypeBuiltInWideAngleCamera
212+
]};
209213
bool foundExactMatch{false};
210-
if (@available(iOS 13.0, *))
211-
{
212-
// Ordered list of cameras by general usage quality.
213-
deviceTypes = @[
214-
AVCaptureDeviceTypeBuiltInTripleCamera,
215-
AVCaptureDeviceTypeBuiltInDualCamera,
216-
AVCaptureDeviceTypeBuiltInDualWideCamera,
217-
AVCaptureDeviceTypeBuiltInWideAngleCamera,
218-
AVCaptureDeviceTypeBuiltInUltraWideCamera,
219-
AVCaptureDeviceTypeBuiltInTelephotoCamera,
220-
AVCaptureDeviceTypeBuiltInTrueDepthCamera
221-
];
222-
}
223-
else
224-
{
225-
// Only these camera types are available for all devices
226-
deviceTypes = @[
227-
AVCaptureDeviceTypeBuiltInDualCamera,
228-
AVCaptureDeviceTypeBuiltInWideAngleCamera
229-
];
230-
}
214+
215+
// The below code would allow us to choose virtual cameras which dynamically switch between the different physical
216+
// camera sensors based on different zoom levels. Until we support letting the consumer modify the camera's zoom
217+
// it would result in often being stuck on the most zoomed out camera on the device which is often not desired.
218+
219+
// if (@available(iOS 13.0, *))
220+
// {
221+
// // Ordered list of cameras by general usage quality.
222+
// deviceTypes = @[
223+
// AVCaptureDeviceTypeBuiltInTripleCamera,
224+
// AVCaptureDeviceTypeBuiltInDualCamera,
225+
// AVCaptureDeviceTypeBuiltInDualWideCamera,
226+
// AVCaptureDeviceTypeBuiltInWideAngleCamera,
227+
// AVCaptureDeviceTypeBuiltInUltraWideCamera,
228+
// AVCaptureDeviceTypeBuiltInTelephotoCamera,
229+
// AVCaptureDeviceTypeBuiltInTrueDepthCamera
230+
// ];
231+
// }
231232

232233
AVCaptureDeviceDiscoverySession* discoverySession{[AVCaptureDeviceDiscoverySession
233234
discoverySessionWithDeviceTypes:deviceTypes

0 commit comments

Comments
 (0)