mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.29k stars 1.07k forks source link

❓ Simultaneously record video or take photos from both rear and front cameras #2164

Closed Skipperlla closed 8 months ago

Skipperlla commented 10 months ago

Question

My goal is to have both rear and ten cameras recording or taking photos at the same time, just like in the bereal app

What I tried

No response

VisionCamera Version

3.6.6

Additional information

mrousavy commented 10 months ago

Hey - I'm not sure if this is currently possible, but you can try to just render two <Camera> Views and see what happens:

<Camera device={backCamera} ... />
<Camera device={frontCamera} ... />
Skipperlla commented 10 months ago

Hey - I'm not sure if this is currently possible, but you can try to just render two <Camera> Views and see what happens:


<Camera device={backCamera} ... />

<Camera device={frontCamera} ... />

I tried this but one worked and the other didn't

mrousavy commented 10 months ago

Well then yea this does not currently work and is quite complex to implement. Did you test on both iOS and Android? I thought it would work

Skipperlla commented 10 months ago

Well then yea this does not currently work and is quite complex to implement. Did you test on both iOS and Android? I thought it would work

Honestly, I didn't try the android part after I saw that it didn't work on the ios part because it was necessary for me on both sides.

mrousavy commented 8 months ago

Well yea, I think this is currently not possible. It would require quite a large refactor of the codebase as on iOS I would need to use a single AVCaptureSession and attach two input Cameras to that - quite a complex thing to do.

Might significantly change the API as well:

const device = useCameraDevice('back')
const camera = useCamera(device)

return <Camera camera={camera} isActive={true} />

and for multi:

const front = useCameraDevice('front')
const back = useCameraDevice('back')
const camera = useCamera([back, front])

return <Camera camera={camera} isActive={true} />

If you want this, consider contacting me thru my agency to figure out a way to collaborate on this.

johhansantana commented 1 month ago

in theory, could you use 2 libraries to record? For example, use this one for back camera and another one for front camera? Or do they basically use the same iOS API and would conflict with each other?

mrousavy commented 1 month ago

No it is the same iOS API.