Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onCurrentExtractedWaveformData #328

Open
Kamoba opened this issue Aug 1, 2024 · 3 comments
Open

onCurrentExtractedWaveformData #328

Kamoba opened this issue Aug 1, 2024 · 3 comments

Comments

@Kamoba
Copy link

Kamoba commented Aug 1, 2024

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
Copy link

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

@himanshuGandhiSimform
Copy link
Collaborator

himanshuGandhiSimform commented Oct 14, 2024

Hello @Kamoba,

Bug 1:
onDone never runs (tested, no logs).
This is because we are not closing the stream as users can extract multiple waveforms from the same instance.

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. - if possible can you share block of code where you facing error so i can check.

Bug 3:
Starting new extration do not stop the previous extraction.
Can you please make sure that you aren't using the same instance of PlayerController when extracting waveforms from multiple audios. If you are then you will need to use another instance or wait for previous one to complete.

Thank you,

@himanshuGandhiSimform himanshuGandhiSimform added the waiting-for-response Waiting for someone to respond. label Oct 14, 2024
@Kamoba
Copy link
Author

Kamoba commented Oct 14, 2024

@himanshuGandhiSimform
Bug 1:
At least provide a method to close it, because previous stream will become parasite for users that do not need it and will be forced to implement a way to skip them.

Bug 2:
Unfortunately i do not have an example in mind, just simple play audio that extract automatically the wave. Playing it many time getting normally something like 40 waveform and time to time (3% of the time, so not easy to reproduce) get some random low number like 1 or 3 waveform without error. Now I'm thinking this may be caused by Bug1... but, wait a minute, no because I implemented my own way to filter "parasite waveform" and can still see it time to time.

Bug 3:
Yes I use the same instance because I need to do play, pause, and resume.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants