zebra-spaces: unmute DJ-stream audio — applyAudioMute() is no-op for non-listeners

startStream() created the <audio> element with muted=true and trusted
applyAudioMute() to unmute it after the user gesture. But that hook
became a listener-only no-op during the recent listener refactor, so
host/speaker self-monitor and host-driven DJ on remote speakers played
silently. Unmute on every startStream() call — the toggle click is
itself a gesture so we no longer need the muted-autoplay workaround.
This commit is contained in:
Russell Ballestrini 2026-06-04 09:51:01 -04:00
parent 3bc3edf9ea
commit 24b42a35bb
No known key found for this signature in database

View file

@ -4124,16 +4124,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 +4941,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">ba7ee3bfe287f743d4e7c3aad2803123</span><br>
sha256 <span class="stamp-sha">3f7ad07e1e1fca3679839edd49c5aed1dce0f9d162f43169d22a505e441098b5</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>