2016-01-13 16 views
6

Android lolipop ve daha yüksek sürümde sesli çağrı kaydetmede sorun yaşıyorum. Bu kodla sesimi kaydedebiliyorum, ancak başkalarının sesini kaydedemiyorum. Android Lollipop ve daha yüksek sürümde Sesli Çağrı Kaydı Çalışmıyor

public void startRecording() { 
    if (recording == false) { 


     Log.e("here", "--------Recorder_Sarted------" + fname); 
     SimpleDateFormat sdf = new SimpleDateFormat("ddMMyyyy"); 
     int randomPIN = (int) (Math.random() * 9000) + 1000; 
     recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION); 
     recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); 
     recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB); 
     String file = Environment.getExternalStorageDirectory().toString(); 
     String filepath = file + "/Aeris/Recording"; 
     File dir = new File(filepath); 
     dir.mkdirs(); 
     Log.e("here ", "----------------" + sdf.format(Calendar.getInstance().getTime()) + " " + fname + " " + type); 
     filepath += "/" + type + "-" + fname + "-" + sdf.format(Calendar.getInstance().getTime()) + "-" + randomPIN + ".3gp"; 
     recorder.setOutputFile(filepath); 

     try { 
      recorder.prepare(); 
     } catch (IllegalStateException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } catch (IOException e) { 
      // TODO Auto-generated catch block 
      e.printStackTrace(); 
     } 
     recorder.start(); 
     recording = true; 
    } 
} 

Bu kod

android lolipop sürümü altında iyi çalışıyor. bana bu sorunu

cevap

0

Chane

recorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION); 

Moto g2 içinde test VOICE_COMMUNICATION (Mikrofon) MIC için AudioSource (Android 6.0), lenovo (Android 5.0), onun çalışma ince çözmeye yardım edin.

İlgili konular