首页 > 解决方案 > Android:Webrtc 如何在录制视频通话时录制(发送方和接收方)的音频

问题描述

当我尝试使用webrtc库录制视频通话时。我可以录制发起者呼叫音频或接收者结束音频。

public static void startRecordingToFile(String filePath, Integer id, @Nullable VideoTrack videoTrack, @Nullable AudioChannel audioChannel, EglBase eglBase, PeerConnectionConfClient peerConnectionClient, AudioSamplesInterceptor inputSamplesInterceptor) throws Exception {

    AudioSamplesInterceptor interceptor = null;
    if (audioChannel == AudioChannel.INPUT)
        interceptor = inputSamplesInterceptor;
    else if (audioChannel == AudioChannel.OUTPUT) {

        if (outputSamplesInterceptor == null)
            outputSamplesInterceptor = new OutputAudioSamplesInterceptor(peerConnectionClient.getJavaAudioDeviceModule());
        interceptor = outputSamplesInterceptor;
    }
    MediaRecorderImpl mediaRecorder = new MediaRecorderImpl(id, videoTrack, interceptor, eglBase);
    File file = new File(filePath);
    mediaRecorder.startRecording(file);
    mediaRecorders.append(id, mediaRecorder);
}

在上面的代码中,我可以记录AudioChannel.INPUTAudioChannel.OUTPUT。但我想使用 webrtc 库在视频通话中合并两者Input和音频。Output

请帮助我们提出您的建议。

标签: androidwebrtcmediarecorderandroid-mediarecorderwebrtc-android

解决方案


推荐阅读