multimodalart HF Staff commited on
Commit
f75e3fe
·
verified ·
1 Parent(s): 7c7586e

Upload index.html with huggingface_hub

Browse files
Files changed (1) hide show
  1. index.html +6 -8
index.html CHANGED
@@ -80,20 +80,18 @@ let captureTimer = null;
80
  let countdownTimer = null;
81
  let running = false;
82
 
83
- const FPS = 10; // webcam frames sent per second
84
  const SESSION_SECONDS = 58;
85
 
86
- // --- jitter buffer: edited frames arrive in bursts (one chunk at a time) but
87
- // we play them out at a smooth, adaptive rate so the preview doesn't stutter.
 
88
  let playQueue = [];
89
- const MAX_QUEUE = 36; // bound latency (~3 chunks)
90
  let lastShown = 0;
91
  function playLoop(ts){
92
  if (playQueue.length > MAX_QUEUE) playQueue = playQueue.slice(-MAX_QUEUE);
93
- // drain faster as the backlog grows, slower when nearly empty
94
- const n = playQueue.length;
95
- const fps = n > 24 ? 18 : n > 14 ? 13 : n > 6 ? 9 : 6;
96
- if (n && ts - lastShown >= 1000 / fps){
97
  outEl.src = playQueue.shift();
98
  outPh.style.display = "none";
99
  lastShown = ts;
 
80
  let countdownTimer = null;
81
  let running = false;
82
 
83
+ const FPS = 15; // webcam frames sent per second
84
  const SESSION_SECONDS = 58;
85
 
86
+ // --- low-latency player: StreamDiffusionV2 streams steadily (~14fps), so we do
87
+ // NOT jitter-buffer. Keep a tiny queue and aggressively drop the backlog so the
88
+ // preview always shows the most recent edit (minimal action->reaction delay).
89
  let playQueue = [];
90
+ const MAX_QUEUE = 3; // ~0.2s worth; drop older frames past this
91
  let lastShown = 0;
92
  function playLoop(ts){
93
  if (playQueue.length > MAX_QUEUE) playQueue = playQueue.slice(-MAX_QUEUE);
94
+ if (playQueue.length && ts - lastShown >= 1000 / 30){
 
 
 
95
  outEl.src = playQueue.shift();
96
  outPh.style.display = "none";
97
  lastShown = ts;