flutter_sound icon indicating copy to clipboard operation
flutter_sound copied to clipboard

[BUG]: Flutter Sound logger

Open ronald-socio opened this issue 3 years ago • 11 comments

Flutter Sound Version : 8.0.0+6

  • FULL or LITE flavor ? ->Full

  • Important: Result of the command : flutter pub deps | grep flutter_sound Dart SDK 2.12.1 Flutter SDK 2.0.2 coupled 1.2.0+023

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

  • Result is not what expected ?
  • Minor issue ?

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.


ronald-socio avatar Apr 08 '21 06:04 ronald-socio

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(); 
    }
  );

osaxma avatar Apr 10 '21 10:04 osaxma

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.

SirBepy avatar Apr 12 '21 07:04 SirBepy

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

funyin avatar May 31 '21 13:05 funyin

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.

expertmars avatar Jun 16 '21 04:06 expertmars

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

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

Larpoux avatar Jun 16 '21 09:06 Larpoux

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

cedvdb avatar Jul 28 '21 21:07 cedvdb

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 avatar Jul 30 '21 14:07 Larpoux

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.

Larpoux avatar Jul 31 '21 18:07 Larpoux

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

cedvdb avatar Aug 02 '21 00:08 cedvdb

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

Larpoux avatar Aug 02 '21 10:08 Larpoux

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.

github-actions[bot] avatar Dec 17 '23 01:12 github-actions[bot]