0

expo-camera is not supported by any of the simulators. Therefore, when using this component in development & on the simulator, it results in an error and data is not stored as it would on the actual device.

Possible Unhandled Promise Rejection. Error: Video recording is not supported on a simulator

This is causing an issue in terms of verifying functionality and the "happy path".
I added an interim check for a video field and then return the basic camera, so at least our flow works, but I don't think it's a long terms solution:

 if (
      process.env.NODE_ENV === 'development' &&
      field.kind === ComponentTypes.VIDEO
    ) {
       return <CameraImage />
    }

How do you work around this intended behavior, in terms of getting data to store? All I can think of doing for this is adding a catch and faking the data:

 cameraRef?.current
        .recordAsync(options)
        .then(vid => {
          console.log({ vid });

          setRecordedVideo(vid);
        })
        .catch(() => {
          if (process.env.NODE_ENV === 'development') {
            setRecordedVideo({
              uri: someFakeUri,
            });
          }
        })
        .finally(() => setIsRecording(false));
Phil Lucks
  • 2,704
  • 6
  • 31
  • 57
  • 1
    There's nothing you can really do with storing camera data on expo go. I recommend using expo-device to only call recordAsync if not using a simulator. – Gus Beringer Dec 13 '22 at 23:11

0 Answers0