zebra-report: tap-resume reload + log retry result
Calls a.load() inside the gesture before a.play() so the retry isn't no-op'ing on an aborted element. Adds 'click' to the listened events since Firefox Android only grants gesture-activation on click in some configs. Logs retry success/failure so we know what's happening.
This commit is contained in:
parent
393b81fb23
commit
31bb90293a
1 changed files with 35 additions and 13 deletions
|
|
@ -4058,24 +4058,46 @@ function streamUrlFor(pubHex){
|
|||
* once. Idempotent install. */
|
||||
const pendingAutoplay = new Set();
|
||||
let tapResumeInstalled = false;
|
||||
let tapResumeRetry = null;
|
||||
function uninstallTapResume(){
|
||||
if (!tapResumeInstalled || !tapResumeRetry) return;
|
||||
document.removeEventListener('pointerdown', tapResumeRetry);
|
||||
document.removeEventListener('touchstart', tapResumeRetry);
|
||||
document.removeEventListener('click', tapResumeRetry);
|
||||
tapResumeInstalled = false; tapResumeRetry = null;
|
||||
}
|
||||
function installTapResume(){
|
||||
if (tapResumeInstalled) return;
|
||||
tapResumeInstalled = true;
|
||||
const retry = () => {
|
||||
if (!pendingAutoplay.size) return;
|
||||
tapResumeRetry = () => {
|
||||
if (!pendingAutoplay.size){ uninstallTapResume(); return; }
|
||||
/* The prior load was aborted by the browser when it denied
|
||||
* autoplay; the <audio> element is in error state. Re-load it
|
||||
* inside the gesture handler so play() has a fresh request to
|
||||
* attach to — bare a.play() on a stuck element silently no-ops. */
|
||||
for (const a of [...pendingAutoplay]){
|
||||
try { a.load(); } catch(_){}
|
||||
const p = a.play();
|
||||
if (p && p.then) p.then(() => pendingAutoplay.delete(a)).catch(()=>{});
|
||||
else pendingAutoplay.delete(a);
|
||||
}
|
||||
if (!pendingAutoplay.size){
|
||||
document.removeEventListener('pointerdown', retry);
|
||||
document.removeEventListener('touchstart', retry);
|
||||
tapResumeInstalled = false;
|
||||
if (p && p.then){
|
||||
p.then(() => {
|
||||
pendingAutoplay.delete(a);
|
||||
logLine('', 'stream resumed after tap');
|
||||
if (!pendingAutoplay.size) uninstallTapResume();
|
||||
}).catch(e => {
|
||||
logLine('err', 'stream tap-retry failed: '+(e && e.message || e));
|
||||
});
|
||||
} else {
|
||||
pendingAutoplay.delete(a);
|
||||
if (!pendingAutoplay.size) uninstallTapResume();
|
||||
}
|
||||
}
|
||||
};
|
||||
document.addEventListener('pointerdown', retry, { passive: true });
|
||||
document.addEventListener('touchstart', retry, { passive: true });
|
||||
/* Listen on click in addition to pointer/touch — Firefox Android
|
||||
* sometimes denies gesture-activation on pointerdown alone and
|
||||
* only grants it on the click event after release. */
|
||||
document.addEventListener('pointerdown', tapResumeRetry, { passive: true });
|
||||
document.addEventListener('touchstart', tapResumeRetry, { passive: true });
|
||||
document.addEventListener('click', tapResumeRetry, { passive: true });
|
||||
}
|
||||
async function startStream(uuid, pubHex){
|
||||
/* DON'T mute the WebRTC audio yet — if the fresh <audio>'s autoplay
|
||||
|
|
@ -4819,8 +4841,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">988fb9812616b4cbd5c7f1073f3e4d01</span><br>
|
||||
sha256 <span class="stamp-sha">7b9cc2c6cdab3bba55beb73b6afa413b784743b986294b3ad4e043f31c553e3f</span><br>
|
||||
md5 <span class="stamp-md5">36ae23a6e8baa61fba8cf6fe48d1c45b</span><br>
|
||||
sha256 <span class="stamp-sha">ef709e213eaad4024f34fc231c804780632207d5b9dd6d1a9a18c9e0eb4b053b</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