// Import the required library
import AudioRecorderPlayer from "react-native-audio-recorder-player";
// Function to stop recording (issue here)
const onStopRecord = React.useCallback(async () => {
try {
// Issue occurs within this function
const result = await audioRecorderPlayer.stopRecorder();
audioRecorderPlayer.removeRecordBackListener();
setRecordSecs(0);
console.log(result);
console.log(result, "Recorder result");
} catch (error) {
console.error("Error stopping recorder:", error);
}
}, []);
字符串
我在使用React Native Audio Recorder Player库时遇到了'onStopRecord'函数的问题。具体来说,我无法正确停止录制,我正在寻求解决此问题的指导。
1条答案
按热度按时间xzv2uavs1#
我从这条线上得到了问题:
字符串
我在我的类中声明了它,但它应该在类外声明,这解决了我的onstoprecord和onstopplay不工作的问题。