本文整理了Java中android.media.MediaRecorder.setAudioSamplingRate()
方法的一些代码示例,展示了MediaRecorder.setAudioSamplingRate()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MediaRecorder.setAudioSamplingRate()
方法的具体详情如下:
包路径:android.media.MediaRecorder
类名称:MediaRecorder
方法名:setAudioSamplingRate
暂无
代码示例来源:origin: robolectric/robolectric
@Test
public void testAudioSamplingRate() throws Exception {
assertThat(shadowMediaRecorder.getAudioSamplingRate()).isNotEqualTo(22050);
mediaRecorder.setAudioSamplingRate(22050);
assertThat(shadowMediaRecorder.getAudioSamplingRate()).isEqualTo(22050);
}
代码示例来源:origin: florent37/CameraFragment
videoRecorder.setAudioSamplingRate(camcorderProfile.audioSampleRate);
videoRecorder.setAudioEncoder(camcorderProfile.audioCodec);
代码示例来源:origin: florent37/CameraFragment
videoRecorder.setAudioSamplingRate(camcorderProfile.audioSampleRate);
videoRecorder.setAudioEncoder(camcorderProfile.audioCodec);
代码示例来源:origin: ankidroid/Anki-Android
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mRecorder.setAudioChannels(2);
mRecorder.setAudioSamplingRate(44100);
mRecorder.setAudioEncodingBitRate(192000);
代码示例来源:origin: stackoverflow.com
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
if (Build.VERSION.SDK_INT >= 10) {
recorder.setAudioSamplingRate(44100);
recorder.setAudioEncodingBitRate(96000);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else {
// older version of Android, use crappy sounding voice codec
recorder.setAudioSamplingRate(8000);
recorder.setAudioEncodingBitRate(12200);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
}
recorder.setOutputFile(file.getAbsolutePath());
try {
recorder.prepare();
} catch (IOException e) {
throw new RuntimeException(e);
}
代码示例来源:origin: dkim0419/SoundRecorder
public void startRecording() {
setFileNameAndPath();
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
mRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
mRecorder.setOutputFile(mFilePath);
mRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
mRecorder.setAudioChannels(1);
if (MySharedPreferences.getPrefHighQuality(this)) {
mRecorder.setAudioSamplingRate(44100);
mRecorder.setAudioEncodingBitRate(192000);
}
try {
mRecorder.prepare();
mRecorder.start();
mStartingTimeMillis = System.currentTimeMillis();
//startTimer();
//startForeground(1, createNotification());
} catch (IOException e) {
Log.e(LOG_TAG, "prepare() failed");
}
}
代码示例来源:origin: Piasy/RxAndroidAudio
mRecorder.setAudioSource(audioSource);
mRecorder.setOutputFormat(outputFormat);
mRecorder.setAudioSamplingRate(sampleRate);
mRecorder.setAudioEncodingBitRate(bitRate);
mRecorder.setAudioEncoder(audioEncoder);
代码示例来源:origin: Piasy/RxAndroidAudio
/**
* prepare for a new audio record.
*/
@WorkerThread
public synchronized boolean prepareRecord(int audioSource, int outputFormat, int audioEncoder,
int sampleRate, int bitRate, File outputFile) {
stopRecord();
mRecorder = new MediaRecorder();
mRecorder.setAudioSource(audioSource);
mRecorder.setOutputFormat(outputFormat);
mRecorder.setAudioSamplingRate(sampleRate);
mRecorder.setAudioEncodingBitRate(bitRate);
mRecorder.setAudioEncoder(audioEncoder);
mRecorder.setOutputFile(outputFile.getAbsolutePath());
// Handle IOException
try {
mRecorder.prepare();
} catch (IOException exception) {
Log.w(TAG, "startRecord fail, prepare fail: " + exception.getMessage());
setError(ERROR_INTERNAL);
mRecorder.reset();
mRecorder.release();
mRecorder = null;
return false;
}
mState = STATE_PREPARED;
return true;
}
代码示例来源:origin: guoxiaoxing/phoenix
mMediaRecorder.setAudioSamplingRate(mCamcorderProfile.audioSampleRate);
mMediaRecorder.setAudioEncoder(mCamcorderProfile.audioCodec);
代码示例来源:origin: guoxiaoxing/phoenix
mMediaRecorder.setAudioSamplingRate(mCamcorderProfile.audioSampleRate);
mMediaRecorder.setAudioEncoder(mCamcorderProfile.audioCodec);
代码示例来源:origin: baiyuliang/QRobot
public void start() throws IOException {
String state = android.os.Environment.getExternalStorageState();
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted,It is " + state+ ".");
}
File directory = new File(path).getParentFile();
if (!directory.exists() && !directory.mkdirs()) {
throw new IOException("Path to file could not be created");
}
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.RAW_AMR);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioSamplingRate(SAMPLE_RATE_IN_HZ);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
}
代码示例来源:origin: Rachel-Ding/Android-Tiny-Projects
mediaRecorder.setAudioSamplingRate(8000);
代码示例来源:origin: stackoverflow.com
MediaRecorder recorder = new MediaRecorder();
File outputFile = new File(Environment.getExternalStorageDirectory(), "audio.3gp");
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setAudioEncodingBitRate(16);
recorder.setAudioSamplingRate(44100);
recorder.setOutputFile(outputFile.getAbsolutePath());
recorder.prepare();
recorder.start();
代码示例来源:origin: stackoverflow.com
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
if (Build.VERSION.SDK_INT >= 10) {
recorder.setAudioSamplingRate(44100);
recorder.setAudioEncodingBitRate(96000);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else {
// older version of Android, use crappy sounding voice codec
recorder.setAudioSamplingRate(8000);
recorder.setAudioEncodingBitRate(12200);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
}
recorder.setOutputFile(file.getAbsolutePath());
try {
recorder.prepare();
} catch (IOException e) {
throw new RuntimeException(e);
}
代码示例来源:origin: stackoverflow.com
MediaRecorder recorder = new MediaRecorder();
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
if (Build.VERSION.SDK_INT >= 10) {
recorder.setAudioSamplingRate(44100);
recorder.setAudioEncodingBitRate(96000);
recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
} else {
// older version of Android, use crappy sounding voice codec
recorder.setAudioSamplingRate(8000);
recorder.setAudioEncodingBitRate(12200);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
}
recorder.setOutputFile(file.getAbsolutePath());
try {
recorder.prepare();
} catch (IOException e) {
throw new RuntimeException(e);
}
代码示例来源:origin: AppLozic/Applozic-Android-SDK
public MediaRecorder prepareMediaRecorder() {
audioRecorder = new MediaRecorder();
audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
audioRecorder.setAudioEncodingBitRate(256);
audioRecorder.setAudioChannels(1);
audioRecorder.setAudioSamplingRate(44100);
audioRecorder.setOutputFile(outputFile);
return audioRecorder;
}
}
代码示例来源:origin: AppLozic/Applozic-Android-SDK
public MediaRecorder prepareMediaRecorder() {
audioRecorder = new MediaRecorder();
audioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);
audioRecorder.setAudioEncodingBitRate(256);
audioRecorder.setAudioChannels(1);
audioRecorder.setAudioSamplingRate(44100);
audioRecorder.setOutputFile(outputFile);
audioRecorder.setOnInfoListener(this);
audioRecorder.setOnErrorListener(this);
return audioRecorder;
}
代码示例来源:origin: QuickBlox/ChatMessagesAdapter-android
private void initMediaRecorder() {
recorder = new MediaRecorder();
recorder.setAudioSource(configurationBuilder.audioSource);
recorder.setOutputFormat(configurationBuilder.outputFormat);
recorder.setOutputFile(configurationBuilder.filePath);
recorder.setAudioChannels(configurationBuilder.channels);
recorder.setAudioEncoder(configurationBuilder.audioEncoder);
recorder.setAudioEncodingBitRate(configurationBuilder.bitRate);
recorder.setAudioSamplingRate(configurationBuilder.samplingRate);
recorder.setMaxDuration(configurationBuilder.duration);
recorder.setOnInfoListener(new OnInfoListenerImpl());
recorder.setOnErrorListener(new OnErrorListenerImpl());
}
代码示例来源:origin: wobiancao/RtspServerAndVlcPlay
mMediaRecorder.setAudioEncoder(mAudioEncoder);
mMediaRecorder.setAudioChannels(1);
mMediaRecorder.setAudioSamplingRate(mQuality.samplingRate);
mMediaRecorder.setAudioEncodingBitRate(mQuality.bitRate);
代码示例来源:origin: UncorkedStudios/recordablesurfaceview
mediaRecorder.setAudioSamplingRate(44100);
mediaRecorder.setAudioEncodingBitRate(96000);
内容来源于网络,如有侵权,请联系作者删除!