【问题标题】:Audio recorder with React Native带有 React Native 的录音机
【发布时间】:2022-01-01 01:01:26
【问题描述】:

我正在尝试在我的应用程序中添加录音机,但由于我是 React Native 的新手,所以遇到了太多问题,请指导我了解任何好的录音包。

谢谢。

【问题讨论】:

  • 请编辑问题以将其限制为具有足够详细信息的特定问题,以确定适当的答案。

标签: react-native avaudiorecorder audiorecord voice-recording call-recording


【解决方案1】:

您可以将react-native-audio-record 与此link 一起使用

示例代码可以看这个:

import AudioRecord from 'react-native-audio-record';
 
const options = {
  sampleRate: 16000,  // default 44100
  channels: 1,        // 1 or 2, default 1
  bitsPerSample: 16,  // 8 or 16, default 16
  audioSource: 6,     // android only (see below)
  wavFile: 'test.wav' // default 'audio.wav'
};
 
AudioRecord.init(options);
 
AudioRecord.start();
 
AudioRecord.stop();
// or to get the wav file path
audioFile = await AudioRecord.stop();
 
AudioRecord.on('data', data => {
  // base64-encoded audio data chunks
});

【讨论】:

    猜你喜欢
    • 2018-11-19
    • 1970-01-01
    • 1970-01-01
    • 2016-02-23
    • 1970-01-01
    • 1970-01-01
    • 2022-08-10
    • 2017-03-07
    • 2019-06-18
    相关资源
    最近更新 更多