Chat icon indicating copy to clipboard operation
Chat copied to clipboard

Bug: Audio recording counter never goes up and stuck on one place. After the record audio shows 0 seconds length and doesn't has sound waves

Open karaevablay opened this issue 7 months ago • 4 comments

The problem is that the audio counter is never going up, doesn't has audio waves and shows that audio has 0 seconds length after the recording.

Before: https://github.com/user-attachments/assets/9913dec6-fd3c-47f0-bb68-83b711c1734f

After making some changes inside of the library, figured out that timer inside Recorder.swift in startRecordingInternal() is set not correctly. Cause it starts inside of Async task it invalidates itself after the return is called. Image below

Image

I've made the following changes to ensure the timer continues running:

  • Added explicit RunLoop configuration for the timer by adding it to the current RunLoop with .common mode
  • Added a check to ensure the timer exists before adding it to the RunLoop
  • Kept the timer reference in the audioTimer property This should keep your timer running even after the function returns. The timer will continue to fire every second and call your onTimer function. Image below
Image

After result:

https://github.com/user-attachments/assets/8dc023ca-a893-41a1-aa31-ca138e2fe1ef

Can someone please help me with the fix, should i make open PR for this bug or should i tell someone from the team?)

Tested on Iphone 16 Pro, iOS 18.3.2

Have a nice day!)

karaevablay avatar Jun 03 '25 12:06 karaevablay

I also have this problem. This patch sort of solved it, though playback still seems to not work and the format sent is not what I specify by my audioFormatID...

singpolyma avatar Jun 04 '25 19:06 singpolyma

@f3dm76 can you please take a look at it ?)

karaevablay avatar Jun 09 '25 10:06 karaevablay

Hey @karaevablay, unfortunately we do not have the resources for open source right now. I'll take a look at this as soon as I have time. In the meantime, you are most welcome to support this library by submitting a PR fixing this issue. Have a nice day

f3dm76 avatar Jun 09 '25 12:06 f3dm76

so after I started holding it right, this did fix for me https://github.com/singpolyma/Chat/commit/7ceb16b6c1692a25f543fba5a69ed0c931dced1d

singpolyma avatar Jul 02 '25 18:07 singpolyma