Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
514 views
in Technique[技术] by (71.8m points)

javascript - 有没有办法使用React native录制音频并将其存储为wave文件?(Is there a way to record audio with React native and store it as a wave file?)

当用户单击按钮时,应用程序应该在用户静音时(例如静音后20秒钟)开始收听音频并停止录制,现在将该音频文件以wave格式(例如test.wav)存储在react中本地人?

  ask by Ravikiran kallepally translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As you already know that there is no inbuilt feature to record audio in React Native, However you can always use third part Library/package.

(您已经知道没有内置功能可以在React Native中录制音频,但是您始终可以使用第三方库/包。)

There are number of them available on NPM.

(NPM上有许多可用的。)

Here is one of them react native audio record

(这是其中之一对本地音频记录的反应)

 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 wavFile: 'test.wav' // default 'audio.wav' }; AudioRecord.init(options); //Start Recording AudioRecord.start(); //Stop Recording AudioRecord.stop(); 

Hope this help

(希望这个帮助)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...