- SDK Version: 46
- 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!