-
Notifications
You must be signed in to change notification settings - Fork 3.5k
[camera_avfoundation] Add lensType to CameraDescription #9959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.9.21+4 | ||
|
||
* Add lensType to CameraDescription | ||
|
||
## 0.9.21+3 | ||
|
||
* Removes code for versions of iOS older than 13.0. | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -32,6 +32,7 @@ class MockCaptureDevice: NSObject, FLTCaptureDevice { | |||||
|
||||||
var uniqueID = "" | ||||||
var position = AVCaptureDevice.Position.unspecified | ||||||
var deviceType: AVCaptureDevice.DeviceType? = nil | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||
|
||||||
var activeFormat: FLTCaptureDeviceFormat { | ||||||
get { | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,10 +157,24 @@ extension CameraPlugin: FCPCameraApi { | |
@unknown default: | ||
lensFacing = .external | ||
} | ||
print(device.deviceType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
var lensType: FCPPlatformCameraLensType | ||
|
||
switch device.deviceType { | ||
case .builtInWideAngleCamera: | ||
lensType = .wide | ||
case .builtInUltraWideCamera: | ||
lensType = .ultraWide | ||
case .builtInTelephotoCamera: | ||
lensType = .telephoto | ||
default: | ||
lensType = .unknown | ||
} | ||
|
||
let cameraDescription = FCPPlatformCameraDescription.make( | ||
withName: device.uniqueID, | ||
lensDirection: lensFacing | ||
lensDirection: lensFacing, | ||
lensType: lensType | ||
) | ||
reply.append(cameraDescription) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line contains a syntax error and will cause a compilation failure. It seems like an incomplete assignment. To test the
.unknown
lens type mapping, you could assign a device type that is not explicitly handled in theCameraPlugin
's switch statement, for example.builtInDualCamera
.