简体   繁体   English

Android 通话录音下行链路静音

[英]Android Call Recording Downlink muted

I am trying to record both Uplink and Downlink voice using Android.我正在尝试使用 Android 录制上行和下行语音。 Regardless the law and everything, i am already aware, so please do not put comments related to the law.不管法律和一切,我已经知道了,所以请不要发表与法律相关的评论。

The code below works fine, except when i mute the microphone, it wont record the downlink voice.下面的代码工作正常,除了当我将麦克风静音时,它不会记录下行语音。

I am using Android 8.1.我正在使用 Android 8.1。 I've tried using a third party app called ACR on the same device, and it works fine, while i am muted, it still records the downlink voice.我试过在同一台设备上使用名为 ACR 的第三方应用程序,它工作正常,虽然我静音,但它仍然记录下行链路语音。

 val audioManager = applicationContext.getSystemService(Context.AUDIO_SERVICE) as AudioManager

 val maximumVolume = audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL)

 audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, maximumVolume, 0)

 val audioSource = MediaRecorder.AudioSource.MIC

 val mediaRecorder = MediaRecorder()

 mediaRecorder.apply {
            setAudioSource(audioSource)
            setOutputFormat(MediaRecorder.OutputFormat.MPEG_4)
            setAudioEncoder(MediaRecorder.AudioEncoder.AAC)
            setAudioChannels(audioChannels)
            setAudioSamplingRate(audioSamplingRate)
            setAudioEncodingBitRate(audioEncodingBitRate)
            setOutputFile(path)
            prepare()
            start()

This is not an issue.这不是问题。 You set the MediaRecorder to use MIC as input, so if you MUTE the microphone it's obliviously that the input signat is lost/muted.您将 MediaRecorder 设置为使用 MIC 作为输入,因此如果您将麦克风静音,显然输入信号丢失/静音。 When you use "downlink" word I expected to see a different input source as VOICECALL or DOWNLINK instead of MIC.当您使用“下行链路”一词时,我希望看到不同的输入源为 VOICECALL 或 DOWNLINK 而不是 MIC。 Trying to record a voicecall using the MIC it's wrong in my opinion because: (1) you have to set max volume to speaker and redirect the voicecall through it (2) while recording a voicecall from the MIC the caller hears ALL what it happens around your device and all what you're saying to other people (3) this method records much noise and echoes.尝试使用 MIC 录制语音通话在我看来是错误的,因为:(1)您必须将最大音量设置为扬声器并通过它重定向语音通话(2)同时从 MIC 录制语音通话,来电者会听到周围发生的所有事情您的设备以及您对其他人所说的所有内容 (3) 此方法会记录大量噪音和回声。 The right way is to record from VOICECALL but most of new devices (using newer Android version) prevents to record from this source and allows it only at System Apps.正确的方法是从 VOICECALL 录制,但大多数新设备(使用较新的 Android 版本)阻止从该来源录制,仅允许在系统应用程序中进行录制。 ACR uses a workaround by calling hidden API methods, but this method could stop stop work at any time due to Android updates. ACR 通过调用隐藏的 API 方法使用一种变通方法,但此方法可能会因 Android 更新而随时停止工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM