SimformSolutionsPvtLtd / audio_waveforms

Use this plugin to generate waveforms while recording audio in any file formats supported by given encoders or from audio files. We can use gestures to scroll through the waveforms or seek to any position while playing audio and also style waveforms
https://pub.dev/packages/audio_waveforms
MIT License
275 stars 141 forks source link

onCurrentExtractedWaveformData #328

Open Kamoba opened 1 month ago

Kamoba commented 1 month ago

Using onCurrentExtractedWaveformData

_audioPlayer.onCurrentExtractedWaveformData.listen((data) {
      extractionWave = data;
     },
      onDone: () { // this never runs
         print("done");
        //saveWave(extractionWave);
        extractionWaveDone = true;
      },
      onError: (Object e, StackTrace stackTrace) { // this look never runs as well
        print('A stream error occurred: $e');
        //extractionWave = [];
      },  
      cancelOnError: false
    );

Bug 1: onDone never runs (tested, no logs). for now just trying to implement something using: _audioPlayer.onCurrentExtractedWaveformData.elementAt(noOfSamples -1).then((data) {

Bug 2: Once a while when the waveform is not rendered well and i check for errors i do not see my logs, look like onError do not runs also.

Bug 3: Starting new extration do not stop the previous extraction. To reproduce, using the player, play audio1 using: await _audioPlayer.preparePlayer with shouldExtractWaveform = true. Then quickly (before audio1 finish extraction), play audio2 then you will receive both data alternatively without any way to differentiate them. For now I'm trying to check data[0] (saved when it start) to determine which one it is.

Using last version of flutter (3.22.2) and this package.

Henriquek47 commented 4 weeks ago

Any updates about Bug 3? Is there a way to bypass the wait for the previous audio?