Open ronald-socio opened 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();
}
);
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.
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
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.
@SirBepy , @funyin : The documentation is in Github repo. (/doc/pages)
It would be great if someone does pull requests with an updated documentation
That goes for the recorder as well. It is working on android without setting the subscription duration though
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.
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.
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
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
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.
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
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.