我打算创建一个录制语音通话的程序,但MediaRecorder.AudioSource.VOICE_COMMUNICATION
不起作用。我认为它不支持许多手机。
我正在尝试使用recorder = new MediaRecorder();
recorder.reset();
recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
recorder.setOutputFormat(MediaRecorder.OutputFormat.AMR_NB);
recorder.setOutputFile(mFileName);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
try {
recorder.prepare();
} catch (IOException e) {
Log.e("LOG", "prepare() failed");
}
recorder.start();
,但它只是记录和上传语音。换句话说,我用麦克风录制声音!!!
我正在尝试使用Calendar
,但声音很糟糕。
以下是我的示例代码:
long curDayDate = 1524787200; // April, 27th, 2018
Instant instant = Instant.ofEpochMilli(curDayDate*1000);
LocalDateTime ldt = instant.atZone(ZoneId.of("GMT")).toLocalDateTime();
int gYear = ldt.getYear();
int gMonth = ldt.getMonthValue();
int gDay = ldt.getDayOfMonth();
Calendar Cal = Calendar.getInstance();
Cal.set(gYear, gMonth, gDay);
for(int i = 0; i < 7; i++) {
// Next day
Cal.add(Calendar.DATE, 1);
System.out.println("Next Year = " + Cal.get(Calendar.YEAR) + ", Next Month = " + Cal.get(Calendar.MONTH) + ", Next Date = " + Cal.get(Calendar.DATE));
}
请帮帮我。谢谢。