
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
media-progress-timer
Advanced tools
This library provides a helper designed for accurate tracking of remote playback position in media applications.
The typical naive approach I've come across simply uses setTimeout without
a reference time and quickly drifts out of sync. To avoid this the library:
requestAnimationFrame for performance / battery friendly updates.setTimeout based fallback mode.Obviously there is still a chance that the remote side and the web application drift apart. With these measures polling code that resynchronizes can be run a lot less frequently, possibly even removed.
There are no fancy build commands or minified versions. Just use the source file as it is or your module loader of choice.
There is also an NPM package at https://www.npmjs.com/package/media-progress-timer
var timer = ProgressTimer({
// Your callback for updating UI state, required.
callback: function(position, duration) {
/* Your code here */
},
// Target frame rate when using legacy setTimeout fallback, default: 30.
fallbackTargetFrameRate: 30,
// Force legacy setTimeout fallback for testing, default: false.
disableRequestAnimationFrame: false
});
// When playback starts set the timer and start it:
timer.set(0, 60000).start();
// When playback pauses, stop the timer:
timer.stop();
// When playback resumes, start the timer:
timer.start();
// When a seek event occours update the position:
timer.set(position)
// When playback stops, reset the timer.
timer.reset();
new ProgressTimer(callback) is also possible if you don't
want to set any options.this and are thus chainable.set call you may omit duration, in this case the timer will
continue using the previous duration.This helper was created in order to help Mopidy client developers handle time better as too many of the clients have been constantly polling for the current time position to "fix" the drifting.
There is nothing Mopidy, or even media specific about this code so if it comes in handy for some other use cases then awesome :-)
See https://github.com/adamcik/media-progress-timer/releases for previous releases.
FAQs
Accurate progress timer for web based media control
The npm package media-progress-timer receives a total of 88 weekly downloads. As such, media-progress-timer popularity was classified as not popular.
We found that media-progress-timer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.