diff --git a/bin/vidref b/bin/vidref
--- a/bin/vidref
+++ b/bin/vidref
@@ -153,7 +153,7 @@ class ReplayMap(PrettyErrorHandler, cycl
})
clips.sort(key=lambda c: len(cast(list, c['songToVideo'])))
- clips = clips[-3:]
+ clips = clips[-int(self.get_argument('maxClips', '3')):]
clips.sort(key=lambda c: c['uri'], reverse=True)
ret = json.dumps(clips)
diff --git a/light9/web/light9-vidref-replay-stack.js b/light9/web/light9-vidref-replay-stack.js
--- a/light9/web/light9-vidref-replay-stack.js
+++ b/light9/web/light9-vidref-replay-stack.js
@@ -11,7 +11,8 @@ class Light9VidrefReplayStack extends Li
return {
songTime: { type: Number, attribute: false }, // from musicState.t but higher res
musicState: { type: Object, attribute: false },
- players: { type: Array, attribute: false }
+ players: { type: Array, attribute: false },
+ size: { type: String, attribute: true }
};
}
@@ -30,13 +31,14 @@ class Light9VidrefReplayStack extends Li
this.songTime += dt;
log('song now', this.songTime);
}
- fineTime() {
+ fineTime() {
if (this.musicState.playing) {
const sinceLastUpdate = (Date.now() - this.musicState.reportTime) / 1000;
this.songTime = sinceLastUpdate + this.musicState.tStart;
- } else {
- // this.songTime = this.musicState.t;
+ } else if (this.lastFineTimePlayingState) {
+ this.songTime = this.musicState.t;
}
+ this.lastFineTimePlayingState = this.musicState.playing;
requestAnimationFrame(this.fineTime.bind(this));
}
@@ -51,7 +53,7 @@ class Light9VidrefReplayStack extends Li
const ws = reconnectingWebSocket('../ascoltami/time/stream',
this.receivedSongAndTime.bind(this));
- reconnectingWebSocket('time/stream', this.receivedRemoteScrubbedTime.bind(this));
+ reconnectingWebSocket('../vidref/time/stream', this.receivedRemoteScrubbedTime.bind(this));
// bug: upon connecting, clear this.song
this.fineTime();
}
@@ -84,6 +86,7 @@ class Light9VidrefReplayStack extends Li
const u = new URL(window.location.href);
u.pathname = '/vidref/replayMap'
u.searchParams.set('song', song);
+ u.searchParams.set('maxClips', this.size == "small" ? '1' : '3');
fetch(u.toString()).then((resp) => {
if (resp.ok) {
resp.json().then((msg) => {
@@ -105,7 +108,7 @@ class Light9VidrefReplayStack extends Li
}
makeClipRow(clip) {
- return html`