" ACR呼叫记录器"在Android工作?

时间:2018-01-23 08:06:30

标签: android mediarecorder android-mediarecorder

AudioSource.VoiceCall
AudioSource.VoiceCommunication
AudioSource.VoiceUplink
AudioSource.VoiceDownlink
AudioSource.Mic //(This only records the callers voice. Not the receivers voice)

MediaRecorder音频源设置为以上都不起作用。制造商可能已禁用通话录音。但是像ACR录像机这样的应用程序是如何工作的?

他们使用的是NDK吗?我试图建立一个类似的应用程序,但最终得出的结论是我必须使用NDK。任何建议都将受到高度赞赏。

Call Recorder - ACR

1 个答案:

答案 0 :(得分:0)

本准则一定会对您有所帮助。 :)

MediaRecorder myAudioRecorder = new MediaRecorder();
String pathFileName= Environment.getDataDirectory()+"/data/"+
                                            getActivity().getPackageName()+"/Audio/";
                                    File directory=new File(pathFileName);
                                    if (!directory.exists()){
                                        directory.mkdir();
                                    }
String fileName = "YESAB_AUDIO_"+System.currentTimeMillis()+".mp3";
                                                audioFilePath=pathFileName+fileName;
                                                myAudioRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);
                                                myAudioRecorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
                                                myAudioRecorder.setAudioEncoder(MediaRecorder.OutputFormat.AMR_NB);
                                                myAudioRecorder.setOutputFile(audioFilePath);
                                                try {
                                                    myAudioRecorder.prepare();
                                                } catch (IOException e) {
                                                    e.printStackTrace();
                                                }
                                                myAudioRecorder.start();