如何使用 React Native Web 录制语音?

How to record voice using react native web?

有没有办法用react native web录制和播放音频?我一直在寻找一些资源,但找不到任何资源。

检查以下 npm 库:

https://github.com/jsierles/react-native-audio

如何使用此模块的简单示例。

import {AudioRecorder, AudioUtils} from 'react-native-audio';
let audioPath = AudioUtils.DocumentDirectoryPath + '/test.aac';

AudioRecorder.prepareRecordingAtPath(audioPath, {
  SampleRate: 22050,
  Channels: 1,
  AudioQuality: "Low",
  AudioEncoding: "aac"
});

为了播放声音,您可以使用以下方法:

https://github.com/zmxv/react-native-sound