这是我的代码,我想将此录制的音频(存储在这里 file:///sdcard/hello.mp4)转换为 base64 字符串。
const path = Platform.select({
ios: 'hello.m4a',
android: 'sdcard/hello.mp4', // should give extra dir name in android. Won't grant permission to the first level of dir.
});
const audioSet = {
AudioEncoderAndroid: AudioEncoderAndroidType.AAC,
AudioSourceAndroid: AudioSourceAndroidType.MIC,
AVEncoderAudioQualityKeyIOS: AVEncoderAudioQualityIOSType.high,
AVNumberOfChannelsKeyIOS: 2,
AVFormatIDKeyIOS: AVEncodingOption.aac,
};
// const result = await audioRecorderPlayer.startRecord(path);
const result = await audioRecorderPlayer.startRecorder(path,audioSet);
audioRecorderPlayer.addRecordBackListener((e) => {
console.log('listning');
console.log(e)
setRecordSecs(`${e.current_position}`);
setRecordTime(audioRecorderPlayer.mmssss(Math.floor(e.current_position)));
return;
});
console.log("start result =====: ",getUriToBase64(result));
};