-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
Describe the bug
Audio recording on iOS is not working as expected — the recorded audio is either incomplete, very short, or missing entirely.
To Reproduce
Steps to reproduce the behavior:
- Set up the recorder with mode "live"
- Check permission
- Record audio for 20-30 s.
- Get the audio path and send it to the server. The actual recording size is 1-2 seconds only
Expected behavior
It should record complete audio.
Smartphone (please complete the following information):
- Device: [iPhone 7]
- OS: [iOS15.8.4 ]
Reproducable code
const {checkHasAudioRecorderPermission, getAudioRecorderPermission} =
useAudioPermission();
const [recorderState, setRecorderState] = useState(RecorderState.stopped);
const startRecord = () => {
recordRef.current
?.startRecord({
updateFrequency: UpdateFrequency.high,
})
.then(() => {})
.catch(() => {});
};
const handleRecorderAction = useCallback(async () => {
if (recorderState === RecorderState.stopped) {
let hasPermission = await checkHasAudioRecorderPermission();
if (hasPermission === PermissionStatus.granted) {
startRecord();
} else if (hasPermission === PermissionStatus.undetermined) {
const permissionStatus = await getAudioRecorderPermission();
if (permissionStatus === PermissionStatus.granted) {
startRecord();
}
} else {
Linking.openSettings();
}
} else {
recordRef.current?.stopRecord().then(path => {
let type = mime.lookup(path.replace('file://', ''));
console.log('path', path);
onSendRecording({mime: type, path});
});
}
}, [
checkHasAudioRecorderPermission,
getAudioRecorderPermission,
onSendRecording,
recorderState,
]);
<Waveform
mode="live"
containerStyle={[AppStyle.fill]}
ref={recordRef}
candleSpace={2}
candleWidth={4}
waveColor={Colors.primary500}
onRecorderStateChange={setRecorderState}
/>
Metadata
Metadata
Assignees
Labels
No labels