在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):adrielcafe/AndroidAudioRecorder开源软件地址(OpenSource Url):https://github.com/adrielcafe/AndroidAudioRecorder开源编程语言(OpenSource Language):Java 100.0%开源软件介绍(OpenSource Introduction):AndroidAudioRecorder
How To Use1 - Add these permissions into your <uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WAKE_LOCK" /> 2 - Open the recorder activity String filePath = Environment.getExternalStorageDirectory() + "/recorded_audio.wav";
int color = getResources().getColor(R.color.colorPrimaryDark);
int requestCode = 0;
AndroidAudioRecorder.with(this)
// Required
.setFilePath(filePath)
.setColor(color)
.setRequestCode(requestCode)
// Optional
.setSource(AudioSource.MIC)
.setChannel(AudioChannel.STEREO)
.setSampleRate(AudioSampleRate.HZ_48000)
.setAutoStart(true)
.setKeepDisplayOn(true)
// Start recording
.record(); 3 - Wait for result @Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == 0) {
if (resultCode == RESULT_OK) {
// Great! User has recorded and saved the audio file
} else if (resultCode == RESULT_CANCELED) {
// Oops! User has canceled the recording
}
}
} Import to your projectPut this into your
FEATURES
DependenciesWant to CONVERT AUDIO into your app?Take a look at AndroidAudioConverter! Example of usage here. License
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论