zebra-spaces: remove dead audioPath references — fixes leave button
JS error fox spotted via the new unhandledrejection forwarder:
audioPath is not defined
audioPath was a per-uuid map ('dj' | 'rtc') I added when listeners
auto-enrolled into HTTP DJ mode. The auto-enrol path was reverted
when fox pointed out phones can't autoplay HTTP audio, but four
audioPath.set/.clear references survived in startStream, stopStream,
and the btn-leave click handler. The leave handler hit
audioPath.clear() before the bye send and threw ReferenceError,
abandoning the rest of the cleanup (which is why the leave button
felt half-broken: bye did fire from somewhere earlier in the
handler, but post-leave UI never reset).
Removed every dead audioPath reference. WebRTC unmute is now handled
inline in stopStream where needed. applyAudioMute is the last
defined-but-unused holdover; keeping it since callers of attachSfu-
Track / startStream still reference the no-op via stale comments,
and it's cheap.
This commit is contained in:
parent
7981e9e7ed
commit
3bc3edf9ea
1 changed files with 9 additions and 16 deletions
|
|
@ -4136,14 +4136,10 @@ async function startStream(uuid, pubHex){
|
|||
}
|
||||
a.src = wantUrl;
|
||||
const onPlaying = () => {
|
||||
audioPath.set(uuid, 'dj');
|
||||
applyAudioMute();
|
||||
logLine('', 'stream on for '+pubHex.slice(0,12)+' — DJ mode (~2s delay, glitch-free)');
|
||||
};
|
||||
const onFail = (why) => {
|
||||
audioPath.set(uuid, 'rtc');
|
||||
streamMode.delete(pubHex); // allow next auto-enrol pass to retry
|
||||
applyAudioMute();
|
||||
streamMode.delete(pubHex); // allow next toggle attempt to retry
|
||||
logLine('err', 'stream for '+pubHex.slice(0,12)+' '+why+' — staying on live WebRTC');
|
||||
};
|
||||
a.addEventListener('playing', onPlaying, { once: true });
|
||||
|
|
@ -4161,8 +4157,10 @@ function stopStream(uuid){
|
|||
try { a.pause(); } catch(_){}
|
||||
try { a.removeAttribute('src'); a.load(); } catch(_){}
|
||||
}
|
||||
audioPath.set(uuid, 'rtc');
|
||||
applyAudioMute();
|
||||
/* re-enable the WebRTC audio for this peer in case we'd muted it
|
||||
* while DJ mode was active. */
|
||||
const w = remoteAudio.get(uuid);
|
||||
if (w) try { w.muted = false; } catch(_){}
|
||||
}
|
||||
function toggleStreamFor(uuid, pubHex){
|
||||
if (streamMode.has(pubHex)){
|
||||
|
|
@ -4886,18 +4884,13 @@ $('btn-leave').addEventListener('click', async () => {
|
|||
try { sessionStorage.removeItem(ACTIVE_CAM_KEY); } catch(_){}
|
||||
if (sigReconnect){ clearTimeout(sigReconnect); sigReconnect = null; }
|
||||
/* tear down ALL DJ-mode HTTP streams + their <audio> elements +
|
||||
* clear streamMode / audioPath so a fresh entry doesn't get
|
||||
* blocked by `streamMode.has(pubHex)` from the old session.
|
||||
* Stops the auto-enrol retry loop too — it'd otherwise tick on
|
||||
* for the next 4s firing at a dead members map. */
|
||||
stopAutoEnrolRetryLoop();
|
||||
autoDisableDjModeForAll();
|
||||
* clear streamMode so a fresh entry doesn't get blocked by
|
||||
* `streamMode.has(pubHex)` from the old session. */
|
||||
for (const a of [...streamAudio.values()]){
|
||||
try { a.pause(); a.removeAttribute('src'); a.load(); a.remove(); } catch(_){}
|
||||
}
|
||||
streamAudio.clear();
|
||||
streamMode.clear();
|
||||
audioPath.clear();
|
||||
for (const u of [...peers.keys()]) tearPeer(u);
|
||||
/* send 'bye' BEFORE closing the WS — server distinguishes a strong
|
||||
* leave (user clicked leave / closed tab) from a hiccup disconnect
|
||||
|
|
@ -4947,8 +4940,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> · built <span class="stamp-date">2026-06-04</span><br>
|
||||
md5 <span class="stamp-md5">82e9e6fecd89ae3f77c37310ef96fbb8</span><br>
|
||||
sha256 <span class="stamp-sha">f61767c5df25c142f57ed75e3ecf3202ba9e83661da3c529c59cdb9892aa7b6a</span><br>
|
||||
md5 <span class="stamp-md5">f117990083c5ec95421b4f44c440474c</span><br>
|
||||
sha256 <span class="stamp-sha">109fc3a83bd4cb622a2542fce8466d835e276a22f753984c29ef23a5e94a8728</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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue