derat/nup

Playback can be reported prematurely when network is flaky

Closed this issue · 0 comments

derat commented

This code from onTimeUpdate_ in music-player.js is problematic:

      const now = getCurrentTimeSec();
      if (this.lastUpdateTime_ > 0) {
        this.totalPlayedSec_ += now - this.lastUpdateTime_;
      }
      this.lastUpdateTime_ = now;

If playback is hanging due to the network being flaky but then resumes later, totalPlayedSec_ gets incremented by the elapsed wall time rather than the amount of the song that was played.

It'd probably be easy to do something smarter using lastTimeUpdatePosition_. I should check what I did in the Android app.