Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
return all the possible cameras
  • Loading branch information
martingeorgiu committed May 10, 2022
commit 53af0773b9beb0c13842e5d9f47ddb7f66ceacf4
8 changes: 7 additions & 1 deletion packages/camera/camera/ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,14 @@ - (void)handleMethodCallAsync:(FlutterMethodCall *)call
result:(FLTThreadSafeFlutterResult *)result {
if ([@"availableCameras" isEqualToString:call.method]) {
if (@available(iOS 10.0, *)) {
NSMutableArray *dicscoveryDevices = [NSMutableArray array];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

[dicscoveryDevices addObject:AVCaptureDeviceTypeBuiltInWideAngleCamera];
[dicscoveryDevices addObject:AVCaptureDeviceTypeBuiltInTelephotoCamera];
if (@available(iOS 13.0, *)) {
[dicscoveryDevices addObject:AVCaptureDeviceTypeBuiltInUltraWideCamera];
}
AVCaptureDeviceDiscoverySession *discoverySession = [AVCaptureDeviceDiscoverySession
discoverySessionWithDeviceTypes:@[ AVCaptureDeviceTypeBuiltInWideAngleCamera ]
discoverySessionWithDeviceTypes:[NSArray arrayWithArray:dicscoveryDevices]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be just discoverySessionWIthDeviceTypes: dicscoveryDevices

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes you're right! I simplified that in the tests as well

mediaType:AVMediaTypeVideo
position:AVCaptureDevicePositionUnspecified];
NSArray<AVCaptureDevice *> *devices = discoverySession.devices;
Expand Down