-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
fix: Allow getCameraDevice
to return undefined
when no Devices are available (e.g. iOS Simulator)
#1848
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
<3 🚀 |
@mrousavy just an idea: could it be possible to have a look how Tesla Motors achieves fake camera previews inside the simulator with their RN module? Maybe it could be copied https://github.com/teslamotors/react-native-camera-kit/blob/master/ios/ReactNativeCameraKit/SimulatorCamera.swift |
@hirbod unfortunately not, no. Also that lib was written by Wix and just got moved to Tesla. The reason why this will not work is because VisionCamera builds upon Camera Devices, allowing the user to select any given camera device. I cannot simulate a fake device, as that would mean I have to:
Which is a shit ton of extra code. Like really, a shit ton. The real solution would be to add support to Cameras on iOS simulators (e.g the macbooks camera, I am surprised this still doesn't work.) |
Yeah, makes sense. That extra work is indeed too much. |
According to this change: mrousavy#1848 We maybe should let devices be undefined.
…e available (e.g. iOS Simulator) (mrousavy#1848) fix: Allow `getCameraDevice` to return `undefined` when no Devices are available
What
On an iOS simulator,
getAvailableCameraDevices()
returns[]
(there are no cameras unfortunately).This PR returns
undefined
instead of throwing an error if no device can be found.Changes
Tested on
Related issues
cc @hamdij0maa