Mercurial > code > home > repos > light9
diff light9/web/light9-vidref-replay-stack.js @ 1986:c8f0d1b9a171
timeline scrubbing shows up on vidref (again)
Ignore-this: 62d3c7ffc411949e211c6e286f551b55
author | drewp@bigasterisk.com |
---|---|
date | Sun, 09 Jun 2019 04:45:24 +0000 |
parents | 3ae1e7f8db23 |
children | 1b690005aabd |
line wrap: on
line diff
--- a/light9/web/light9-vidref-replay-stack.js Sun Jun 09 02:04:56 2019 +0000 +++ b/light9/web/light9-vidref-replay-stack.js Sun Jun 09 04:45:24 2019 +0000 @@ -35,7 +35,7 @@ const sinceLastUpdate = (Date.now() - this.musicState.reportTime) / 1000; this.songTime = sinceLastUpdate + this.musicState.tStart; } else { - this.songTime = this.musicState.t; + // this.songTime = this.musicState.t; } requestAnimationFrame(this.fineTime.bind(this)); } @@ -51,6 +51,7 @@ const ws = reconnectingWebSocket('../ascoltami/time/stream', this.receivedSongAndTime.bind(this)); + reconnectingWebSocket('time/stream', this.receivedRemoteScrubbedTime.bind(this)); // bug: upon connecting, clear this.song this.fineTime(); } @@ -67,6 +68,17 @@ this.getReplayMapForSong(this.song); } } + + receivedRemoteScrubbedTime(msg) { + this.songTime = msg.st; + + // This doesn't work completely since it will keep getting + // updates from ascoltami slow updates. + if (msg.song != this.song) { + this.song = msg.song; + this.getReplayMapForSong(this.song); + } + } getReplayMapForSong(song) { const u = new URL(window.location.href);