Last active
October 28, 2018 19:31
-
-
Save abbasnaqdi/0a901b3b1bab9e528f77994335e63413 to your computer and use it in GitHub Desktop.
The MediaRecorder formula is compatible with various Android versions and high-quality audio recorder, Tested on Android 21 to 28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The MediaRecorder formula is compatible with various Android versions and high-quality audio recorder, | |
// Tested on Android 21 to 28 | |
mediaRecorder = MediaRecorder().apply { | |
setAudioSource(MediaRecorder.AudioSource.MIC) | |
setOutputFormat(MediaRecorder.OutputFormat.MPEG_4) | |
setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC) | |
setOutputFile(filePath) | |
setAudioEncodingBitRate(320000) | |
setAudioSamplingRate(96000) | |
} | |
mediaRecorder?.apply { | |
prepare() | |
start() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment