zebra-spaces: prime audioCtx on first interaction (fix desktop auto-rejoin)

This commit is contained in:
russell@unturf.com 2026-06-05 16:05:54 -04:00
parent d7fd405150
commit c2d6016c8b
No known key found for this signature in database

View file

@ -7365,6 +7365,34 @@ $('rdv-code').addEventListener('keydown', e=>{
if(e.key==='Enter'){ e.preventDefault(); primeAudioOnGesture(); joinSpace(); }
});
/* Desktop auto-rejoin (below) reaches joinSpace() without a click, so
* the entry-button gesture never fires. Chrome (Fedora especially)
* leaves audioCtx suspended until a real user gesture, and the
* fire-and-forget audioCtx.resume() inside attachAudioStreamViaWorklet
* silently fails outside a gesture → no audio, no waveform, no
* mic-open indicator. Fox 2026-06-05: "speaker on firefox chrome was
* hard restarted and cannot hear host."
*
* Document-wide one-shot listener: on first interaction anywhere (any
* click, any keydown), prime audio. Idempotent — primeAudioOnGesture()
* is safe to re-run because it checks `audioCtx` and only resumes if
* suspended. Unregisters itself after firing so we don't repeatedly
* spawn silent oscillators. */
(function installFirstGesturePrimer(){
let primed = false;
function prime(){
if (primed) return;
primed = true;
try { primeAudioOnGesture(); } catch(e){ logLine('err','first-gesture prime: '+e.message); }
document.removeEventListener('click', prime, true);
document.removeEventListener('keydown', prime, true);
document.removeEventListener('touchstart', prime, true);
}
document.addEventListener('click', prime, true);
document.addEventListener('keydown', prime, true);
document.addEventListener('touchstart', prime, true);
})();
/* ?code=… autofills the rendezvous code (used by the share URL). The code
* stays in the URL so a refresh keeps you in the same space; if you want
* to leave it cleanly, hit the leave button or close the tab. */
@ -7504,8 +7532,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-05</span><br>
md5 <span class="stamp-md5">7728cca3f32432a3b21a633d303261a6</span><br>
sha256 <span class="stamp-sha">4d1e388864b2f7673158985e3e9a3442c96439132bca62f04ae8be0694affe39</span><br>
md5 <span class="stamp-md5">9aca7c642e3a0f7ea5ea104cc114cbde</span><br>
sha256 <span class="stamp-sha">c295a568dfcf5df8567bce78e5ab90503bcec52fa9ae3a64d433000803dabc2d</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>