react-native-audio-waveform icon indicating copy to clipboard operation
react-native-audio-waveform copied to clipboard

Wrong Duration Calculation and Gesture error

Open ashfaq-ahmed opened this issue 1 year ago • 2 comments
trafficstars

Hi, thanks for the work. I am using this in a react native project and was facing a few issues that I wanted to get help with. Here is my code

<Waveform
                        mode="static"
                        ref={playerRef}
                        path={ audio.path}
                        onPlayerStateChange={(state) => setPlayerState(state)}
                        containerStyle={{ flex: 1, height: 40}}
                        candleSpace={3}
                        candleHeightScale={7}
                        waveColor='#BABABA'
                        scrubColor={props.isOutbound ? Colors.black : Colors.white}
                        candleWidth={3}
                        onCurrentProgressChange={(currentProgress: number, songDuration: number) => {
                            setSoundDuration(formatMilliseconds(songDuration));
                            setSoundProgress(formatMilliseconds(currentProgress));
                        }}
                        onError={(error) => console.log(error)}
                    />

This is the format of the audio path /storage/emulated/0/Download/Aq13PXxGzF.m4a I tried changing it to file:// format but the app started crashing

  1. The library gives wrong duration of the audio files (specially when I go to same screen second time, it gives zero).
Screenshot 2024-06-22 at 10 50 00 AM
  1. Some times I get back negative duration Screenshot 2024-06-22 at 12 13 43 PM

  2. In a FlatList , if I try to scroll by placing the finger on waveform, I get this error Screenshot 2024-06-22 at 12 12 05 PM

I am using react-native 0.74.1

ashfaq-ahmed avatar Jun 22 '24 08:06 ashfaq-ahmed

@ashfaq-ahmed Thank you for your interest in this library and for reporting this issue. we will surely look into it and resolve this as soon as possible. Feel free to fork this and fix the issue and raise PR. we always welcome PRs that strengthen this library and increase its usability.

mukesh-simform avatar Jun 24 '24 04:06 mukesh-simform

@ashfaq-ahmed For issue 1 and Issue 3, You can consider these changes in your node modules and confirm once. Let us know if this persists for you. Also could you please explain a bit more about Issue 2, it's working as expected and we're not getting any negative values.

mukesh-simform avatar Jun 24 '24 11:06 mukesh-simform