Canardoux / flutter_sound

Flutter plugin for sound. Audio recorder and player.
Mozilla Public License 2.0
875 stars 573 forks source link

[BUG]: Flutter Sound logger #654

Open ronald-socio opened 3 years ago

ronald-socio commented 3 years ago

Flutter Sound Version : 8.0.0+6

|-- flutter_sound 8.0.0+6 | |-- flutter... | |-- flutter_sound_platform_interface 8.0.0+6 | | |-- flutter... | | |-- meta... | | '-- plugin_platform_interface... | |-- flutter_sound_web 8.0.0+6 | | |-- flutter... | | |-- flutter_sound_platform_interface... | | |-- flutter_web_plugins... | | |-- js... | | '-- meta... | |-- flutter_spinkit 5.0.0 | | '-- flutter... | |-- logger 1.0.0 | |-- path... | |-- path_provider... | |-- provider 5.0.0 | | |-- collection... | | |-- flutter... | | '-- nested 1.0.0 | | '-- flutter... | |-- recase 4.0.0-nullsafety.0 | |-- synchronized 3.0.0 | '-- uuid 3.0.3 | '-- crypto...

Severity


Platforms you faced the error

Emulator Android Pixel 3A


Describe the bug When declaring StreamSubscription, player.onProgress.listen not triggering functions

To Reproduce playerSubsciption = player.onProgress!.listen((e){ double progress = e.duration.inMilliseconds.toDouble(); \Not triggering this } ) Full Code: https://pastebin.com/c9Wmkcgq

Logs!!!!

No logs presented since it did not do anything.


osaxma commented 3 years ago

You need to set the update frequency before starting the player such as:


await player.setSubscriptionDuration(const Duration(milliseconds: 100); // <~~ this is necessary 
await player.startPlayer(.....);

// from here on, you can listen to updates at whatever frequency you set above
playerSubsciption = player.onProgress!.listen((e) {
    double progress = e.duration.inMilliseconds.toDouble(); 
    }
  );
SirBepy commented 3 years ago

Hey, I just wanted to let you guys know that I really like the package, but I hope you manage to make a better documentation. At the very least, in the pub.dev Example tab, add a full example of the screen you made in the Readme tab. I had no idea I had to use setSubscriptionDuration, I ended up spending a few hours looking at your examples in the code, but I still never saw that you used this.

funyin commented 3 years ago

This is a very wonderful package, thanks a lot. Please add this to the documentation or fix it. I had to beat around till I found it plus the documentation says the subscriptionDuration is already 100 by default which is not the case.

You need to set the update frequency before starting the player such as:

await player.setSubscriptionDuration(const Duration(milliseconds: 100); // <~~ this is necessary 
await player.startPlayer(.....);

// from here on, you can listen to updates at whatever frequency you set above
playerSubsciption = player.onProgress!.listen((e) {
    double progress = e.duration.inMilliseconds.toDouble(); 
    }
  );

with that answer, I think you can close this issue

expertmars commented 3 years ago

hello, this is very important to update this to the documentation. I spend 2 days behind this and while I am searching for another package found this fix. Thank you anyway guys. Very helpful package by the way.

Larpoux commented 3 years ago

@SirBepy , @funyin : The documentation is in Github repo. (/doc/pages)

It would be great if someone does pull requests with an updated documentation

cedvdb commented 3 years ago

That goes for the recorder as well. It is working on android without setting the subscription duration though

Larpoux commented 3 years ago

Hello guys and girls,

I just found a major bug on iOS which can explain all the problems encountered by the developers with onProgress() and setSubscriptionDuration().

This bug will be fixed in the next release.

In the next version, it will be also possible to call setSubscriptionDuration() after the startPlayer() or the startRecorder(). It will be possible to change dynamically the frequency, during the playback/recording.

I also developed a very simple example which trigger the onProgress() callback.

Finally I updated the documentation to say explicitly that a call to setSubscriptionDuration() is mandatory to receive the callbacks.

I really hope that developers will not have anymore issues in this area.

Larpoux commented 3 years ago

Flutter Sound 8.3.8 is released. I hope that the problems with onProgress() not fired is now just a bad memory and everything ok, now.

Please re-open this issue if still problems.

cedvdb commented 3 years ago

Did you add a logging library ? Imo it's better to have an onEvent stream that we can listen to and log it if needed.

If every library does this you have 20 logging libraries. This is just my opinion though

Larpoux commented 3 years ago

Did you add a logging library ? Imo it's better to have an onEvent stream that we can listen to and log it if needed.

Hi @cedvdb , yes Flutter Sound uses now a logger library. This is better than before, because the App can decide not to log Flutter Sound. But you are right : we already had someone who complained that there was incompatibility of my logger library and its own library. And I am not happy with the actual outputs of the logger.

Yes, an onEvent stream is certainly a very good idea. Please keep this issue open

github-actions[bot] commented 10 months ago

This issue is stale because it has been open 90 days with no activity. Leave a comment or this will be closed in 7 days.