-
Notifications
You must be signed in to change notification settings - Fork 98
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
Speed up camera publishing #377
Conversation
|
||
DispatchQueue.global(qos: .background).async { [weak self] in | ||
guard let self else { return } | ||
_observation = session.observe(\.devices, options: [.initial, .new]) { [weak self] _, value in |
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.
do we want to periodically refresh this list? thinking about a case where cameras become available after init (i.e. USB/continuity camera on Mac, external camera on iOS)
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 is observing the devices
property so it should be ok. But continuity devices are not included now, maybe I should include it.
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.
oh awesome, I missed that. lgtm!
|
||
DispatchQueue.global(qos: .background).async { [weak self] in | ||
guard let self else { return } | ||
_observation = session.observe(\.devices, options: [.initial, .new]) { [weak self] _, value in |
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.
oh awesome, I missed that. lgtm!
] | ||
#else | ||
deviceTypes = [ | ||
.builtInWideAngleCamera, |
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.
what about .external and .continuityCamera?
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.
Will add 🙂
let deviceTypes: [AVCaptureDevice.DeviceType] | ||
#if os(iOS) | ||
deviceTypes = [ | ||
.builtInDualCamera, |
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.
would these show up as diff devices? or the same? if they are all different, it would be confusing right?
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.
I think the device manager should bring aware of all devices but for the user facing device enumeration API, i can add a filter option (default on) to output only common devices
Maintain a internal list of AVCaptureDevices to speed up publishing.