react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 Camera not recording audio

Open ChristopherGabba opened this issue 3 years ago • 25 comments

What's happening?

I am using the camera to record a video. If I take that video path and play it in an expo video, it plays fine but no audio plays. After hours of troubleshooting, I've narrowed it down to the fact that the video being captured by react-native-vision-camera is just not capturing audio.

I previously had multiple packages requesting microphone permissions (expo-av and react-native-vision-camera) and I have removed expo-av's microphone permissions from app.json to only allow react-native-vision camera. I am also using react-native-volume manager to manipulate audio and volume sessions in an effort to troubleshoot.

Reproduceable Code

I copied the code from the react-native-vision-camera demo with the Capture Button and the Camera UI exactly. So the reproducable demo is the camera code in this package. 

Using an iPhone 12 physical device connected through expo dev client. 

I then take the file.path from the onMediaCaptured callback and play it in:

        <Video
          source={{
            uri: "file:///private/var/mobile/Containers/Data/Application/97BBA11E-AB1D-4E15-BE96-C2FAB7D8C8F8/tmp/ReactNative/61BF091A-B1D5-4B8A-A08D-F3576C9C7167.mp4",
          }}
          style={{ width: 300, height: 300 }}
          volume={1}
          useNativeControls
          isLooping
          shouldPlay={true}
          isMuted={false}
        />
and tried to mess with the volume like so during troubleshooting: 
  useEffect(() => {
    ;(async function manageVolume() {
      Audio.setAudioModeAsync({
        playsInSilentModeIOS: true,
      });
      // VolumeManager.enableInSilenceMode(true)
      // VolumeManager.showNativeVolumeUI({ enabled: true })
      await VolumeManager.setVolume(0.5)
      // VolumeManager.enable(true, true) // Enable async
      // VolumeManager.setActive(true, true) // Activate async
    })()
  }, [])

Relevant log output

Actually do not know how to do this... Not much experience with xcode..

Camera Device

{
  "position": "back",
  "hasTorch": true,
  "supportsLowLightBoost": false,
  "hardwareLevel": "full",
  "isMultiCam": false,
  "minZoom": 1,
  "supportsFocus": true,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "neutralZoom": 1,
  "supportsRawCapture": false,
  "formats": [
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 144,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 192,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 144,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 192,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 59.326927185058594,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 288,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 352,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 3696
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 59.326927185058594,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 288,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 352,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 3696
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 360,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 480,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 360,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 480,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 480,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 640,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 480,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 640,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 1512,
      "videoHeight": 480,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 640,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 94.5,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 2016
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 1512,
      "videoHeight": 480,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 640,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 94.5,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 2016
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2384,
      "videoHeight": 540,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 960,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 124.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2384,
      "videoHeight": 540,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 960,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 124.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 768,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1024,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 171.875,
      "videoStabilizationModes": [
        "auto",
        "off",
        "standard"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 768,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1024,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 171.875,
      "videoStabilizationModes": [
        "auto",
        "off",
        "standard"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2376,
      "videoHeight": 720,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 123.75,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2376,
      "videoHeight": 720,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 123.75,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": true,
      "photoHeight": 2376,
      "videoHeight": 720,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 123.75,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2384,
      "videoHeight": 720,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 124.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2384,
      "videoHeight": 720,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 124.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 1188,
      "videoHeight": 720,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 61.875,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 2112
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 1188,
      "videoHeight": 720,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 61.875,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 2112
    },
    {
      "minISO": 33,
      "maxFps": 240,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 720,
      "videoHeight": 720,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 240,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 1320,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 67.5,
      "videoStabilizationModes": [
        "auto",
        "off",
        "standard"
      ],
      "photoWidth": 1280
    },
    {
      "minISO": 33,
      "maxFps": 240,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 720,
      "videoHeight": 720,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 240,
      "videoWidth": 1280,
      "supportsDepthCapture": false,
      "maxISO": 1320,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 67.5,
      "videoStabilizationModes": [
        "auto",
        "off",
        "standard"
      ],
      "photoWidth": 1280
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 1512,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1440,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 94.5,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 2016
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 64.72028350830078,
      "supportsVideoHDR": false,
      "photoHeight": 1512,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1440,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 94.5,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 2016
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2376,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 123.75,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2376,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 123.75,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": true,
      "photoHeight": 2376,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 123.75,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2384,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 124.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2384,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 124.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 1188,
      "videoHeight": 1080,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 61.875,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 2112
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 1188,
      "videoHeight": 1080,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 61.875,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 2112
    },
    {
      "minISO": 33,
      "maxFps": 120,
      "fieldOfView": 38.78413772583008,
      "supportsVideoHDR": false,
      "photoHeight": 1080,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 120,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 1320,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 135,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard"
      ],
      "photoWidth": 1920
    },
    {
      "minISO": 33,
      "maxFps": 120,
      "fieldOfView": 38.78413772583008,
      "supportsVideoHDR": false,
      "photoHeight": 1080,
      "videoHeight": 1080,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 120,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 1320,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 135,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard"
      ],
      "photoWidth": 1920
    },
    {
      "minISO": 33,
      "maxFps": 240,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 1080,
      "videoHeight": 1080,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 240,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 1320,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 67.5,
      "videoStabilizationModes": [
        "auto",
        "off",
        "standard"
      ],
      "photoWidth": 1920
    },
    {
      "minISO": 33,
      "maxFps": 240,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 1080,
      "videoHeight": 1080,
      "autoFocusSystem": "contrast-detection",
      "supportsPhotoHDR": false,
      "minFps": 240,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 1320,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 67.5,
      "videoStabilizationModes": [
        "auto",
        "off",
        "standard"
      ],
      "photoWidth": 1920
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 1440,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 157.5,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 1440,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 157.5,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": true,
      "photoHeight": 3024,
      "videoHeight": 1440,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 157.5,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 1512,
      "videoHeight": 1440,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 94.5,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 2016
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 1512,
      "videoHeight": 1440,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 1920,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 94.5,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 2016
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 1944,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 2592,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 1944,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 2592,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 2448,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 3264,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 2448,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 3264,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2376,
      "videoHeight": 2160,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 3840,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 129.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2376,
      "videoHeight": 2160,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 3840,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 129.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": true,
      "photoHeight": 2376,
      "videoHeight": 2160,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 3840,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 129.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 4224
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2160,
      "videoHeight": 2160,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 3840,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 129.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 3840
    },
    {
      "minISO": 33,
      "maxFps": 60,
      "fieldOfView": 70.29109191894531,
      "supportsVideoHDR": false,
      "photoHeight": 2160,
      "videoHeight": 2160,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 60,
      "videoWidth": 3840,
      "supportsDepthCapture": false,
      "maxISO": 3168,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 129.125,
      "videoStabilizationModes": [
        "auto",
        "cinematic",
        "off",
        "standard",
        "cinematic-extended"
      ],
      "photoWidth": 3840
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 3024,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 4032,
      "supportsDepthCapture": false,
      "maxISO": 5808,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    },
    {
      "minISO": 33,
      "maxFps": 30,
      "fieldOfView": 67.09603881835938,
      "supportsVideoHDR": false,
      "photoHeight": 3024,
      "videoHeight": 3024,
      "autoFocusSystem": "phaseDetection",
      "supportsPhotoHDR": false,
      "minFps": 30,
      "videoWidth": 4032,
      "supportsDepthCapture": false,
      "maxISO": 5808,
      "pixelFormats": [
        "yuv",
        "yuv",
        "rgb",
        "yuv",
        "yuv",
        "rgb"
      ],
      "maxZoom": 189,
      "videoStabilizationModes": [
        "auto",
        "off"
      ],
      "photoWidth": 4032
    }
  ],
  "id": "com.apple.avfoundation.avcapturedevice.built-in_video:0",
  "sensorOrientation": "landscape-right",
  "name": "Back Camera",
  "hasFlash": true,
  "maxZoom": 123.75
}

Device

iPhone 12 Physical Device

VisionCamera Version

"react-native-vision-camera": "^3.0.0",

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

ChristopherGabba avatar Nov 04 '23 13:11 ChristopherGabba

facing the same issue here

itsabk avatar Nov 06 '23 08:11 itsabk

I fixed my issue by updating the hasMicrophonePermission state as per the correct permission. It was being passed to the audio prop in the ReanimatedCamera component

itsabk avatar Nov 06 '23 09:11 itsabk

@itsabk I've confirmed on numerous occasions that I have the correct microphone permissions, reinstalled the app to get the permissions re-requested, passed true directly to the audio prop directly and just tried a bunch of combinations and I just get a muted video every time.

Several weeks ago it was working, and sometime in the past couple of weeks on the project I deleted my Android and iOS folders to go back to a pure expo project and I am thinking it might be related. I am re-following the expo installation criteria that Marc provides in the docs and it looks like I need to prebuild. I'm working through lots of build errors conflicting with a Share Extension package in my project but once I am able to successfully Expo prebuild, I'll check to see if this fixes my problem and let you know.

ChristopherGabba avatar Nov 06 '23 11:11 ChristopherGabba

Update 11/7/2023: I got the project to properly expo prebuild and compile and still no audio after new development build. I then downloaded Expo Camera to see if I could get any audio to record and it worked perfectly (recorded audio). Very confident that it is this react native vision camera package.

Here is my plugin code in app.json:

      [
        "react-native-vision-camera",
        {
          "cameraPermissionText": "ReelFeel needs access to your Camera.",
          "enableMicrophonePermission": true,
          "microphonePermissionText": "ReelFeel needs access to your Microphone."
        }
      ],

And rebuild the camera screen in a SUPER simplified manner with no bells and whistles as an experiment:

export const CameraTestScreen: FC<CameraScreenProps> = observer(function CameraTestScreen(
  _props, // @demo remove-current-line
) {
  const { navigation } = _props

  const camera = useRef<Camera>()
  const isFocused = useIsFocused()
  const isForeground = useIsForeground()
  const isActive = isFocused && isForeground

  const [hasMicrophonePermission, setHasMicrophonePermission] = useState(false)

  useEffect(() => {
    ;(async function getPermissions() {
      const cameraStatus = await Camera.requestCameraPermission()
      const microphoneStatus = await Camera.requestMicrophonePermission()
      if (cameraStatus === "granted" && microphoneStatus === "granted") {
        console.log("got both permissions")
        setHasMicrophonePermission(true)
      }
    })()
  }, [isFocused])

  const device = useCameraDevice("front")

  const onError = useCallback((error: CameraRuntimeError) => {
    console.error(error)
  }, [])

  const onInitialized = useCallback(() => {
    console.log("Camera initialized!")
  }, [])

  const onMediaCaptured = useCallback(
    async (media: PhotoFile | VideoFile, type: "photo" | "video") => {
      //   const asset = await MediaLibrary.createAssetAsync(media.path)
      console.log(`Media captured! ${JSON.stringify(media)}`)
    },
    [navigation],
  )

  const startRecording = useCallback(async () => {
    try {
      if (camera.current == null) throw new Error("Camera ref is null!")

      console.log("calling startRecording()...")
      camera.current.startRecording({
        // fileType: "mp4",
        onRecordingError: (error) => {
          console.error("Recording failed!", error)
        },
        onRecordingFinished: (video) => {
          console.log(`Recording successfully finished! ${video.path}`)
          onMediaCaptured(video, "video")
        },
      })
    } catch (e) {
      console.error("failed to start recording!", e, "camera")
    }
  }, [camera, onMediaCaptured])

  const stopRecording = useCallback(async () => {
    try {
      if (camera.current == null) throw new Error("Camera ref is null!")

      console.log("calling stopRecording()...")
      await camera.current.stopRecording()
      console.log("called stopRecording()!")
    } catch (e) {
      console.error("failed to stop recording!", e)
    }
  }, [camera])

  return (
    <Screen preset="fixed" contentContainerStyle={$container}>
      {device != null && hasMicrophonePermission && (
        <Camera
          ref={camera}
          style={$camera}
          device={device}
          isActive={isActive}
          onInitialized={onInitialized}
          onError={onError}
          orientation="portrait"
          video={true}
          audio={hasMicrophonePermission}
        />
      )}
      <Button style={$recordButton} onPress={startRecording} />
      <Button style={$stopRecordingButton} onPress={stopRecording} />
      <Button style={$back} onPress={() => navigation.goBack()} />
    </Screen>
  )
})

const $container: ViewStyle = {
  height: "100%",
  width: "100%",
}

const $recordButton: ViewStyle = {
  position: "absolute",
  left: 100,
  bottom: 50,
  width: 50,
  height: 50,
  borderRadius: 25,
  backgroundColor: "green",
}

const $stopRecordingButton: ViewStyle = {
  position: "absolute",
  right: 100,
  bottom: 50,
  width: 50,
  height: 50,
  borderRadius: 25,
  backgroundColor: "red",
}

const $back: ViewStyle = {
  position: "absolute",
  top: 100,
  left: 50,
  width: 50,
  height: 50,
  backgroundColor: "orange",
}

const $camera: ViewStyle = {
  flex: 1,
}

ChristopherGabba avatar Nov 07 '23 12:11 ChristopherGabba

Hi @ChristopherGabba ran into this same problem and rolling back to previous release solved it yarn remove react-native-vision-camera && yarn add [email protected]

alefrometa avatar Nov 08 '23 01:11 alefrometa

@alefrometa Thanks for the info, are you able to record video with flash on 3.6.3? I think this may have broke too in 3.6.4

nica0012 avatar Nov 08 '23 02:11 nica0012

@alefromet Thank you for the response. I just tried this and recorded a video and there still is no audio playing when I play the video back. I actually rolled versions all the way back to 3.0.0 and still had no luck...

ChristopherGabba avatar Nov 08 '23 02:11 ChristopherGabba

FYI: "react-native": "0.70.5", "react-native-vision-camera": "2",

itsabk avatar Nov 08 '23 06:11 itsabk

fixed ;)

mrousavy avatar Nov 10 '23 11:11 mrousavy

@mrousavy You rock, thank you Marc!

ChristopherGabba avatar Nov 10 '23 12:11 ChristopherGabba

I currently have this issue, How do I install this fix

BenQoder avatar Nov 12 '23 14:11 BenQoder

@ChristopherGabba hey, I am running into the same issue. how were you able to fix things?

griffinbaker12 avatar Nov 17 '23 07:11 griffinbaker12

@ChristopherGabba hey, I am running into the same issue. how were you able to fix things?

There's a new update... with it my issue was resolved

BenQoder avatar Nov 17 '23 07:11 BenQoder

Same here!

griffinbaker12 avatar Nov 17 '23 16:11 griffinbaker12

Update from Marc 3.6.6 fixed the issue. I was able to run npm install react-native-vision-camera and then run npx expo prebuild --clean and then I deleted my ios and android folders. Then I created a new development build npx eas build --profile development --platform ios after that, audio is officially working. Make sure your silent switch is off. Not sure if all these steps were necessary, but my issue is now resolved. Thanks @mrousavy and all

ChristopherGabba avatar Nov 17 '23 19:11 ChristopherGabba

Marc*

mrousavy avatar Nov 20 '23 12:11 mrousavy

But glad to hear it's resolved, thanks @ChristopherGabba! :)

mrousavy avatar Nov 20 '23 12:11 mrousavy

Marc*

Apologies, autocorrect got me, I knew that (corrected above) :) thanks again...

ChristopherGabba avatar Nov 20 '23 12:11 ChristopherGabba

Original comment https://github.com/mrousavy/react-native-vision-camera/issues/3524#issuecomment-2903150574

Do you use react-native-video? Try to add disableAudioSessionManagement={true} to the Video component If that doesn't work, try to downgrade the react-native-video version to 6.10.2 which is the latest version doesn't have audioSessionManager.

allanmnolasco avatar Sep 17 '25 13:09 allanmnolasco

I was using 4.7.2; I had to downgrade to 3.6.6 to get the audio working.

abumubaarak avatar Sep 29 '25 16:09 abumubaarak