From 46f520c39f55fd60fcc5ead36cf70b30141d7f50 Mon Sep 17 00:00:00 2001 From: YC_Lin Date: Sun, 8 Sep 2024 23:21:52 +0800 Subject: [PATCH] Fix the issue of the audio recording segment repeating at the end on the Android platform. --- src/Plugin.Maui.Audio/AudioRecorder/AudioRecorder.android.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Plugin.Maui.Audio/AudioRecorder/AudioRecorder.android.cs b/src/Plugin.Maui.Audio/AudioRecorder/AudioRecorder.android.cs index ae3597d..5e188ad 100644 --- a/src/Plugin.Maui.Audio/AudioRecorder/AudioRecorder.android.cs +++ b/src/Plugin.Maui.Audio/AudioRecorder/AudioRecorder.android.cs @@ -162,9 +162,8 @@ void WriteAudioDataToFile() { while (audioRecord.RecordingState == RecordState.Recording) { - audioRecord.Read(data, 0, bufferSize); - - outputStream.Write(data); + var read = audioRecord.Read(data, 0, bufferSize); + outputStream.Write(data, 0, read); } outputStream.Close();