How to Implement Audio Recording's pauseAsync method?

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

I am trying to implement a recording feature in my app. I need to provide the pause and resume recording feature. The documentation says that the Recording Class has a pauseAsync() method. However when I try to implement it, it doesnt work.

This is how I start the recording (this works fine):

async function startRecording() {
    
  try {
    console.log('Requesting permissions..');
    await Audio.requestPermissionsAsync();
    await Audio.setAudioModeAsync({
      allowsRecordingIOS: true,
      playsInSilentModeIOS: true,
    }); 
    await recordingObj.prepareToRecordAsync(Audio.RecordingOptionsPresets.HIGH_QUALITY);
    await recordingObj.startAsync();
    setRecording(recordingObj);
    console.log('Recording started');
    handleStartTimer();
  } catch (err) {
    console.error('Failed to start recording', err);
  }
  
}

This is my pauseRecording function:

async function pauseRecording(){
  try{
  await recordingObj.pauseAsync();
  } catch (err){
    console.log(err)
  }
}

When I call pauseRecording, I get the following error:

Cannot complete operation because this recorder is not ready to record.
at node_modules/expo-av/build/Audio/Recording.js:121:18 in _performOperationAndHandleStatusAsync
at http://192.168.2.26:19000/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&hot=false&strict=false&minify=false:null in _performOperationAndHandleStatusAsync
at node_modules/expo-av/build/Audio/Recording.js:314:15 in pauseAsync

any help would be appreciated!

Expo Team, can you please confirm if a paused recorder can be resumed? I am finding this counter intuitive that we have a pause function but no resume function

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