streamana/site/update-limiter.js
David Halls 2479db5401 Start handling portrait video
Android phones typically only support encoding of landscape.
Still need to rotate the display back again.
2021-07-16 07:18:18 +01:00

16 lines
318 B
JavaScript

export class UpdateLimiter {
constructor(nps) {
this.threshold = nps ? 1000/nps : 0;
this.last = 0;
}
check() {
const now = Date.now();
if ((now - this.last) >= this.threshold) {
this.last = now;
return true;
}
return false;
}
}