Just_audio: Position updates during buffering with no sound

Created on 5 Feb 2020  路  9Comments  路  Source: ryanheise/just_audio

While buffering, the song's current position updates while listening to getPositionStream stream but with no sound. This causes the UI progress bar to keep updating like the song is playing and the song current time updating without actually any sound. However the preloader shows its buffering. After buffering, it is updated with the current(true) time

3 testing bug

Most helpful comment

I believe this is still an issue on ios. Getting position update in playing state with no sound first. Then position is reseted when audio starts a playback. Some logs:

flutter: 2020-03-02T16:07:01.188939 I   new AudioService.<ac>:   state changed: AudioPlaybackState.stopped
flutter: 2020-03-02T16:07:01.190283 I   new AudioService.<ac>:   state changed: AudioPlaybackState.playing
flutter: 2020-03-02T16:07:01.392662 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.203000
flutter: 2020-03-02T16:07:01.596361 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.407000
flutter: 2020-03-02T16:07:01.710461 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.000000
flutter: 2020-03-02T16:07:01.710859 I   new AudioService.<ac>:   state changed: AudioPlaybackState.playing
flutter: 2020-03-02T16:07:01.711824 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.002000

Let me know if I could help with that. And thank you for this library @ryanheise !

All 9 comments

Currrently as a temporary fix, before I update my UI with the current time, I first make sure the audioplayer is in playing state (and not buffering)

Ah, yes. I assume you're using getPositionStream() which in turn uses the position getter In AudioPlaybackEvent:

  /// The current position of the player.
  Duration get position => state == AudioPlaybackState.playing
      ? updatePosition +
          (Duration(milliseconds: DateTime.now().millisecondsSinceEpoch) -
                  updateTime) *
              speed
      : updatePosition;

That state == AudioPlaybackState.playing condition should be followed by && !buffering.

Just fixed. Do you want to try the latest commit?

Sure, lemme check it out now 鈽猴笍

Perfect, fixed. All good.

I believe this is still an issue on ios. Getting position update in playing state with no sound first. Then position is reseted when audio starts a playback. Some logs:

flutter: 2020-03-02T16:07:01.188939 I   new AudioService.<ac>:   state changed: AudioPlaybackState.stopped
flutter: 2020-03-02T16:07:01.190283 I   new AudioService.<ac>:   state changed: AudioPlaybackState.playing
flutter: 2020-03-02T16:07:01.392662 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.203000
flutter: 2020-03-02T16:07:01.596361 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.407000
flutter: 2020-03-02T16:07:01.710461 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.000000
flutter: 2020-03-02T16:07:01.710859 I   new AudioService.<ac>:   state changed: AudioPlaybackState.playing
flutter: 2020-03-02T16:07:01.711824 I   AudioControlListenBloc._updatePosition:  state: PlayerState.playing position: 0:00:00.002000

Let me know if I could help with that. And thank you for this library @ryanheise !

@ryanheise Please fix this issue ASAP

I've reopened this issue, as the iOS side will need to be investigated.

@nomyzs apologies for not seeing your comment sooner.

However, I'm in the process of moving apartments, so it may be a while before I can take a look.

Can you confirm whether this is solved in the latest release? If not, can you test the media-source branch?

Closing due to inactivity. I believe this is now working in the latest release but if not, please open a new issue with a minimal reproduction project.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ali-alizadeh picture ali-alizadeh  路  6Comments

suragch picture suragch  路  9Comments

ryanheise picture ryanheise  路  13Comments

lain-ke picture lain-ke  路  4Comments

mohammadne picture mohammadne  路  6Comments