Record Room Audio during a Phonne Call

Universal Camera 276 Reputation points
2022-05-10T19:43:08.713+00:00

My Xamarin.Forms App works great for recording Room Audio but produces total silence recording during a Phone call...

. if (mediaRecorder == null)
{
Task.Run(() =>
{
var path = new File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryMusic), "Audio_Recorded.3gp");
mediaRecorder = new MediaRecorder();
mediaRecorder.Reset();
mediaRecorder.SetAudioSource(AudioSource.VoiceCommunication);
mediaRecorder.SetOutputFormat(OutputFormat.ThreeGpp);
mediaRecorder.SetAudioEncoder(AudioEncoder.AmrNb);
mediaRecorder.SetOutputFile(path.AbsolutePath);
mediaRecorder.Prepare();
mediaRecorder.Start();// Recording is now started
});
}

Following Run-Time Permissions are being Granted except for ... Manifest.Permission.CaptureAudioOutput,

    public static string[] PERMISSIONS_REQUIRED =
    {
        Manifest.Permission.Camera,
        Manifest.Permission.WriteExternalStorage,
        Manifest.Permission.CaptureAudioOutput,
        Manifest.Permission.ModifyAudioSettings,
        Manifest.Permission.RecordAudio,
        Manifest.Permission.WakeLock,
        Manifest.Permission.AccessNetworkState,
        Manifest.Permission.ReadExternalStorage
    };

Does my Silent Recording stem from improper Permissions? If so how to resolve Manifest.Permission.CaptureAudioOutput.

If its another issue then how do I fix That????

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,325 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yonglun Liu (Shanghai Wicresoft Co,.Ltd.) 38,756 Reputation points Microsoft Vendor
    2022-05-11T05:24:57.033+00:00

    Hello,

    produces total silence recording during a Phone call...

    Referring to the official documentation about MediaRecorder, we can find that:

    Capturing from VOICE_CALL source requires the Manifest.permission.CAPTURE_AUDIO_OUTPUT permission. This permission is reserved for use by system components and is not available to third-party applications.

    That's the reason the issue occurs.

    Best Regards,

    Alec Liu.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.