Skip to content
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

feat: Add support for new External, Continuity and LiDAR Cameras #1813

Closed
wants to merge 1 commit into from

Conversation

mrousavy
Copy link
Owner

What

This PR adds support for four new Camera Devices on iOS:

  • External Cameras (On iPad, external devices are those that conform to the UVC (USB Video Class) specification)
  • Continuity Cameras (e.g. your Mac's Camera streamed through AirPlay)
  • True Depth Camera (a Camera device streaming both depth data (through Infrared) and colors (YUV))
  • LiDAR Camera (a Camera device streaming both depth data (through a LiDAR sensor) and colors (YUV))

Blockers

Currently, a device looks like this:

{
  devices: ('wide-angle-camera' | 'ultra-wide-angle-camera' | 'telephoto-camera')[]
  position: 'front' | 'back' | 'external'
}

But the external and continuity cameras don't have the device types. They don't tell me whether they're wide-angle or ultra-wide etc., they just say they're external. Therefore I either need to add a unknown or external type to the devices, which is kinda lame as the lens information should be known (through FOV/focal length). Only the position should be external in that case.
I'll need to investigate this, but unfortunately I don't have a device to test this on. Someone wanna borrow me an iPad?

Changes

Tested on

Related issues

@vercel
Copy link

vercel bot commented Sep 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
react-native-vision-camera ✅ Ready (Inspect) Visit Preview Sep 19, 2023 7:32am

@mrousavy mrousavy closed this Sep 21, 2023
@mrousavy mrousavy deleted the feat/new-cameras branch September 21, 2023 09:43
@tiste
Copy link

tiste commented Sep 26, 2023

Hello @mrousavy, I have time if you want me to test it on a real device.

@mrousavy
Copy link
Owner Author

Thanks @tiste !

@basememara
Copy link

Why was this closed, is LiDAR camera support still in the making or was merged somewhere else?

@jarbozhang
Copy link

I have tested the external webcam functionality on the Logitech HD Webcam C270 model, and it works normally in both the iPad FaceTime application and the Zoom application. However, in this project, specifying useCameraDevice('external') returns undefined, and using getAvailableCameraDevices only returns the two front and one back cameras of the iPad 10.

@mrousavy
Copy link
Owner Author

@jarbozhang you could try adding this code to CameraDevicesManager.swift in the getAllDeviceTypes() function at the bottom:

    if #available(iOS 17.0, *) {
      deviceTypes.append(.external)
      deviceTypes.append(.continuityCamera)
    }

@jarbozhang
Copy link

@jarbozhang you could try adding this code to CameraDevicesManager.swift in the getAllDeviceTypes() function at the bottom:

    if #available(iOS 17.0, *) {
      deviceTypes.append(.external)
      deviceTypes.append(.continuityCamera)
    }

Thank you very much for your response. For now, I can only fork a copy of the repo and then deploy to npm. I look forward to your updates!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants