Unable to start recording with Audio

Please provide the following:

  1. SDK Version: 35
  2. Platforms(Android/iOS/web/all): all

I’ve been trying to get the recording to work. I’m testing on a physical android device.

I’ve even pulled most of the code directly from the docs, here’s what I have:

const [recording, setRecording] = useState(new Audio.Recording());

  const handleRecordAudio = async () => {
    console.log("entered!");

    recording.setOnRecordingStatusUpdate(status =>
      console.log("status", status)
    );
    try {
      await recording.prepareToRecordAsync(Audio.RECORDING_OPTIONS_PRESET_HIGH_QUALITY)
      await recording.startAsync()

      // You are now recording!
    } catch (error) {
      console.log("error caught!", error);
    }
  }

And this renders the following output:

entered!
status Object {
  "canRecord": false,
  "durationMillis": 0,
  "isDoneRecording": false,
  "isRecording": false,
}
status Object {
  "canRecord": true,
  "durationMillis": 0,
  "isRecording": false,
}
status Object {
  "canRecord": true,
  "durationMillis": 0,
  "isRecording": false,
}
error caught! [Error: Start encountered an error: recording not started]

What am I doing wrong here?

This was resolved by restarting my phone after development, because the recording was still running, after an unsuccessful recording attempt, throughout all of these tests and changes.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.