zebra-report: deploy DJ-unmute + video lip-sync fixes

- DJ self-monitor stream now plays audibly (was muted-start with no
  unmute path for non-listeners)
- Screen / camera / game receivers get the same playoutDelayHint as
  audio so the picture stays in sync with the voice
This commit is contained in:
russell@unturf.com 2026-06-04 09:52:33 -04:00
parent 22ecc0b5ba
commit 0843aa1317
No known key found for this signature in database

View file

@ -2632,6 +2632,13 @@ function handleRemoteSfuTrack(ev){
if (kind === 'screen' || kind === 'camera' || kind === 'game'){
logLine('', 'sfu ontrack: kind=' + kind + ' pub=' + pubHex +
' track=' + ev.track.kind + ' mute=' + ev.track.muted + ' state=' + ev.track.readyState);
/* Video receivers (screen / camera / game) match the audio receiver's
* playoutDelayHint so the picture stays in sync with the voice. The
* mic jitter buffer is 4s; without a matching hint on video, mouse
* clicks / mouth movement / keystrokes lead the voice by ~4s. Audio
* is more vital than video — video adapts to audio's delay, never
* the other way around. */
try { if (ev.receiver) ev.receiver.playoutDelayHint = RECV_PLAYOUT_DELAY_SEC; } catch(_){}
}
/* MSID-supplant safety: the SFU re-uses the same streamID
* (`shortPub-kind`) when a publisher supplants themselves. WebRTC
@ -4124,16 +4131,17 @@ async function startStream(uuid, pubHex){
a = document.createElement('audio');
a.autoplay = true; a.controls = false;
a.preload = 'auto'; a.playsInline = true;
/* start muted so autoplay is universally allowed (muted autoplay
* has no gesture requirement on any browser). applyAudioMute()
* unmutes the moment the user gesture lands (btn-mute click) AND
* this peer's canonical path is set to 'dj' by the 'playing'
* listener below. */
a.muted = true;
document.body.appendChild(a);
streamAudio.set(uuid, a);
await applySinkTo(a);
}
/* Toggle click is itself a user gesture, so unmuted play is allowed
* without the muted-autoplay workaround. Older code muted-started and
* relied on applyAudioMute() to unmute later, but that hook is a
* no-op for non-listeners now — host/speaker self-monitor (and host
* DJ-mode on remote speakers) was playing silently. Unmute on every
* call so a reused element from a prior stop also re-monitors. */
try { a.muted = false; } catch(_){}
a.src = wantUrl;
const onPlaying = () => {
logLine('', 'stream on for '+pubHex.slice(0,12)+' — DJ mode (~2s delay, glitch-free)');
@ -4940,8 +4948,8 @@ logLine('', 'ready — pick a handle, type a rendezvous code, enter the space');
<footer style="margin:2.2rem auto 0;font-size:0.65rem;color:#999;line-height:1.7;word-break:break-all;font-family:monospace">
<span id="pi-seal" style="color:#777;cursor:default;user-select:none" title="">page integrity</span> &nbsp;·&nbsp; built <span class="stamp-date">2026-06-04</span><br>
md5 <span class="stamp-md5">f117990083c5ec95421b4f44c440474c</span><br>
sha256 <span class="stamp-sha">109fc3a83bd4cb622a2542fce8466d835e276a22f753984c29ef23a5e94a8728</span><br>
md5 <span class="stamp-md5">884a96ec7223a1a6998a58c20135b48c</span><br>
sha256 <span class="stamp-sha">5e7cb79da69ca902af2a9f365fc851e89b370f3e8316633e28144cd1e53a5311</span><br>
<span style="color:#bbb">hashes are of this page with these two fields zeroed — to verify, blank them and re-hash</span><br>
<span style="color:#bbb">one self-contained file — <strong>save a copy</strong> and verify against these hashes; point at your own servers with ?signal= and ?turncred=, or <a href="host-your-own.html" style="color:#999">host your own community</a></span>
</footer>