react-native-audio-toolkit故障记录

时间:2018-01-24 07:40:13

标签: android audio react-native

当我使用react-native-audio-toolkit录制时,以下输出是垃圾应该是wav或mp3。我做错了什么?

  let rec = new Recorder('adrec.mp3', {bitrate: 128000, channels: 2, sampleRate: 44100}).prepare((err, fsPath) => {
  if (err) {
    console.log('error at as23424')
    console.log(err)
  } else {
    filePathRec = fsPath
  }
})

rec.record()

// Stop recording after approximately 3 seconds
setTimeout(() => {
  rec.stop((err) => {
    // NOTE: In a real situation, handle possible errors here
    if (err) {

    } else {

      RNFS.readFile(filePathRec, 'base64').then((content) => {

输出:

AAAAGGZ0eXAzZ3A0AAAAAGlzb20zZ3A0AAAVCG1kYXQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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RibAAAAEVzdHNkAAAAAAAAAAEAAAA1c2FtcgAAAAAAAAABAAAAAAAAAAAAAQAQAAAAAB9AAAAAAAARZGFtciAgIAAAg/8AAQAAACBzdHRzAAAAAAAAAAIAAAABAAAAoAAAAKcAAACgAAAAFHN0c3oAAAAAAAAAIAAAAKgAAAAcc3RzYwAAAAAAAAABAAAAAQAAAKgAAAABAAAAFHN0Y28AAAAAAAAAAQAAACA=

你可以看到许多A

1 个答案:

答案 0 :(得分:0)

输出是音频文件的base64编码版本。如果要将其解码以进行测试,请在e处输入。 G。 this website

它会将您的base64字符串解码为 3gp音频文件,持续时间为3秒。据我所知,没有声音(这就是为什么有这么多A s),但基本上创建了一个有效的音频文件。

要使用其他音频格式,请查看文档(Recorder methods)并在Recorder构造函数中指定一个:

new Recorder('adrec.mp3', {bitrate: 128000, channels: 2, sampleRate: 44100, format: 'aac'})