audioplayers icon indicating copy to clipboard operation
audioplayers copied to clipboard

Add onPlaybackRateChanged (Stream<double>)

Open dvorapa opened this issue 4 years ago • 7 comments

Similarly to onAudioPositionChanged and onDurationChanged

dvorapa avatar Jan 09 '20 16:01 dvorapa

Might also be solved with https://github.com/luanpotter/audioplayers/issues/512

dvorapa avatar May 14 '20 12:05 dvorapa

Closing this due to reports of this being fixed on newer versions. Feel free to open a new issue in case of this still happening

erickzanardo avatar Apr 13 '21 13:04 erickzanardo

I kindly disagree as there is no onPlaybackRateChanged (or similar) stream in audioplayers' documentation. This feature request haven't been solved yet. Please reopen this issue or prove it is solved

dvorapa avatar Apr 13 '21 23:04 dvorapa

I kindly disagree as there is no onPlaybackRateChanged (or similar) stream in audioplayers' documentation. This feature request haven't been solved yet. Please reopen this issue or prove it is solved

You are correct. The linked issue confused me and I though it was a merged pr instead, re opening.

erickzanardo avatar Apr 14 '21 00:04 erickzanardo

Yeah this is definitely this is not implemented yet.

But I am wondering why this is needed, because playback rate is exclusively controlled by the user. duration and position change on the backend and thus need streams. We don't have a stream for volume for example.

Is there a bit more context on why this is needed?

luanpotter avatar Apr 14 '21 14:04 luanpotter

The current state is, that user has to set some rate state variable and update it every time he calls setPlaybackRate. Also he has to call a callback at all these places recalculating position and duration. So it ends up with a lot of the same code in several places. I made a workaround to do all of this stuff when position changes. This makes it more unintuitive, but works well (see https://github.com/dvorapa/stepslow/blob/master/lib/main.dart). For me this is no longer needed as my workaround works. Feel free to close it if you feel it's not worth the time spent on it.

dvorapa avatar Apr 14 '21 20:04 dvorapa

I agree on having a variable to check the current rate, but I don't see a reason for a constantly updated stream, as it's controlled by the user.

Ok I think I understand: the duration and position (in seconds) may changes dependent on the rate, as in real time the overall duration of a song is larger or shorter then. But this may needs rather another stream for realTimeDuration and realTimePosition and in contrast to the player position and duration. But honestly I think it's something the user can solve himself, if needed.

Gustl22 avatar Aug 29 '22 22:08 Gustl22