Upload index.html with huggingface_hub
Browse files- 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 =
|
| 84 |
const SESSION_SECONDS = 58;
|
| 85 |
|
| 86 |
-
// ---
|
| 87 |
-
//
|
|
|
|
| 88 |
let playQueue = [];
|
| 89 |
-
const MAX_QUEUE =
|
| 90 |
let lastShown = 0;
|
| 91 |
function playLoop(ts){
|
| 92 |
if (playQueue.length > MAX_QUEUE) playQueue = playQueue.slice(-MAX_QUEUE);
|
| 93 |
-
|
| 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;
|