Comments (5)
Thinking about this some more, I'm sure this is not a bug in the timer itself, but rather an artefact of the specific sequence of start
and set
calls that the web extension calls based on Mopidy events.
I can't figure it out however, and wonder if
Line 114 in 28007e9
ProgressTimer.prototype.stop
or ProgressTimer.prototype.reset
.
Either that, or there is some sort of unexpected delay in
Lines 87 to 88 in 28007e9
setTimeout
call to fail?from media-progress-timer.
Some more debugging results:
- Mopidy-Musicbox-Webclient uses
mopidy.playback.getTimePosition
to get the time position from Mopidy. - when the end of the track is reached, the timer is reset to the length of the next track to be played, and starts polling Mopidy again with
mopidy.playback.getTimePosition
to figure out if the track has actually started to play yet so that it can sync up the progress timer.
The problem seems to be that (at least in Mopidy <= 1.1.2), the value that is returned by mopidy.playback.getTimePosition
can be a little unpredictable as a track change is occurring. It looks as if Mopidy does not return '0' as soon as one track has finished playback and before the next track starts, but instead keeps returning a position associated with the previous track that we are changing from until some time after the next track has started to play.
The end result is that the web client tries to update the progress timer with a position that is greater than the timer's duration
, and
Line 114 in 28007e9
I guess the question then is whether it is reasonable for the timer to terminate the update loop if it receives a set
value that is greater than duration
. It is a little unforgiving and can cause issues when the consumer thinks that the timer should still be running (because a stop was not triggered explicitly).
Possible solutions could be to:
- prevent the timer from self-terminating; or
- let the consumer know when this has happened so that it can trigger a restart if it still needs the timer to be running.
from media-progress-timer.
Ah, that explains a lot. I spent a lot of time trying to fix this for 2.0, but I can see how we should probably be more robust against "bad" data due to this type of issue.
from media-progress-timer.
I don't think changing this for everyone is a great idea. What I'm considering instead is giving you an "overrun" option, which controls if you continue scheduling or stop when position catches up with duration.
from media-progress-timer.
An 'overrun' option would be handy. This should also be less of an issue for Mopidy >= 2.0, in which I believe mopidy.playback.getTimePosition
may return more consistent results during track transitions.
I think lots of people are still using Mopidy <= 1.1.2 on their Rasperry Pi's though, so it probably makes sense to make the changes regardless.
from media-progress-timer.
Related Issues (4)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from media-progress-timer.