Commit 426cbfcc by Matt Mascarenhas

cinera_player_pre.js: Use YouTube API's timer

This lets users of Firefox 59+ get sub-millisecond accurate performance:
https://developer.mozilla.org/en-US/docs/Web/API/Performance/now
parent 845a824d
......@@ -16,7 +16,7 @@ typedef struct
version CINERA_APP_VERSION = {
.Major = 0,
.Minor = 5,
.Patch = 50
.Patch = 51
};
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c
......@@ -787,6 +787,7 @@ StringsDifferT(char *A, // NOTE(matt): Null-terminated string
char Terminator // NOTE(matt): Caller definable terminator. Pass 0 to only match on the extent of A
)
{
// TODO(matt): Make sure this can't crash upon reaching the end of B's buffer
int ALength = StringLength(A);
int i = 0;
while(i < ALength && A[i] && A[i] == B[i])
......
......@@ -43,7 +43,6 @@ function Player(htmlContainer, refsCallback) {
this.pauseAfterBuffer = false;
this.speed = 1;
this.currentTime = -1;
this.lastFrameTime = 0;
this.scrollTo = -1;
this.scrollPosition = 0;
this.nextFrame = null;
......@@ -250,11 +249,8 @@ Player.prototype.updateProgress = function() {
};
Player.prototype.doFrame = function() {
var now = performance.now();
var delta = (now - this.lastFrameTime) / 1000.0;
this.lastFrameTime = now;
if (this.playing) {
this.currentTime += delta * this.speed;
this.currentTime = this.youtubePlayer.getCurrentTime();
}
this.updateProgress();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment