我怎样才能在Android中录制的语音和通话记录?通话记录、语音、Android

2023-09-13 23:38:14 作者:绾起梨花月

请帮我,如果你知道如何录制声音,还打电话时同时记录呼叫者和卡莱的声音。如果有人知道,然后给我一个提示。

Please help me if you know how to record voice, and also to record the voice of both caller and calle during a phone call. If anybody knows then give me a hint.

推荐答案

是有可能只是做到这一点

Yes It is possible just do this

final MediaRecorder callrecorder = new MediaRecorder();
callrecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);
callrecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
callrecorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);

callrecorder.setOutputFile(filepath);

try {
    callrecorder.prepare();
} catch (IllegalStateException e) {
    System.out.println("An IllegalStateException has occured in prepare!");
    // TODO Auto-generated catch block
    e.printStackTrace();
} catch (IOException e) {

    //throwing I/O Exception
    System.out.println("An IOException has occured in prepare!");
    // TODO Auto-generated catch block
    e.printStackTrace();
}

try {
    callrecorder.start();
} catch(IllegalStateException e) {
    e.printStackTrace();
    //Here it is thorowing illegal State exception
    System.out.println("An IllegalStateException has occured in start!");
}

停止,你可以使用

for stopping you can use

callrecoder.stop();
 
精彩推荐
图片推荐