zebra-spaces: deeper audio-element telemetry for listener path
Last click showed touched=4 and no play() rejections, yet phone is silent — so the issue isn't the click handler returning early. It's that the audio elements themselves are in some not-actually-playing state we're not catching. This commit logs per-element: paused, muted, readyState, srcObject presence (rtc) / src + networkState (dj), and the path tag. Also ALWAYS attempts play() in the click handler regardless of mute decision so the user gesture isn't wasted.
This commit is contained in:
parent
8d861e94a6
commit
c8fc119ea7
1 changed files with 24 additions and 18 deletions
|
|
@ -4085,32 +4085,38 @@ const audioPath = new Map(); // uuid -> 'dj' | 'rtc'
|
|||
let listenerOutputMuted = true;
|
||||
function applyAudioMute(){
|
||||
const silenced = (myRole === 'listener' && listenerOutputMuted);
|
||||
let touched = 0, played = 0, failed = 0;
|
||||
let touched = 0;
|
||||
for (const [uuid, a] of remoteAudio){
|
||||
const wantRtc = !silenced && audioPath.get(uuid) !== 'dj';
|
||||
const path = audioPath.get(uuid);
|
||||
const wantRtc = !silenced && path !== 'dj';
|
||||
/* In a listener click context, we ALWAYS attempt to play —
|
||||
* the gesture might be the only chance to unblock a paused
|
||||
* element. Unmute on wantRtc=true; keep muted on wantRtc=false. */
|
||||
try {
|
||||
a.muted = !wantRtc;
|
||||
touched++;
|
||||
if (wantRtc) {
|
||||
const p = a.play();
|
||||
if (p && p.then) p.then(()=>played++).catch(e=>{ failed++; logLine('err','rtc play '+uuid+': '+e.message); });
|
||||
else played++;
|
||||
}
|
||||
} catch(e){ failed++; logLine('err','rtc set mute '+uuid+': '+e.message); }
|
||||
const p = a.play();
|
||||
if (p && p.catch) p.catch(e => logLine('err','rtc play '+uuid+' paused='+a.paused+' rs='+a.readyState+' src='+!!a.srcObject+' err='+e.name+': '+e.message));
|
||||
} catch(e){ logLine('err','rtc setmute '+uuid+': '+e.message); }
|
||||
}
|
||||
for (const [uuid, a] of streamAudio){
|
||||
const wantDj = !silenced && audioPath.get(uuid) === 'dj';
|
||||
const path = audioPath.get(uuid);
|
||||
const wantDj = !silenced && path === 'dj';
|
||||
try {
|
||||
a.muted = !wantDj;
|
||||
touched++;
|
||||
if (wantDj) {
|
||||
const p = a.play();
|
||||
if (p && p.then) p.then(()=>played++).catch(e=>{ failed++; logLine('err','dj play '+uuid+': '+e.message); });
|
||||
else played++;
|
||||
}
|
||||
} catch(e){ failed++; logLine('err','dj set mute '+uuid+': '+e.message); }
|
||||
const p = a.play();
|
||||
if (p && p.catch) p.catch(e => logLine('err','dj play '+uuid+' paused='+a.paused+' rs='+a.readyState+' src='+!!a.src+' err='+e.name+': '+e.message));
|
||||
} catch(e){ logLine('err','dj setmute '+uuid+': '+e.message); }
|
||||
}
|
||||
logLine('', 'applyAudioMute silenced='+silenced+' touched='+touched+' streamMode='+streamMode.size);
|
||||
/* state snapshot — per-element so we can see what each is actually doing */
|
||||
for (const [uuid, a] of remoteAudio){
|
||||
logLine('', 'rtc '+uuid.slice(0,8)+' paused='+a.paused+' muted='+a.muted+' rs='+a.readyState+' srcObj='+!!a.srcObject+' path='+audioPath.get(uuid));
|
||||
}
|
||||
for (const [uuid, a] of streamAudio){
|
||||
logLine('', 'dj '+uuid.slice(0,8)+' paused='+a.paused+' muted='+a.muted+' rs='+a.readyState+' netState='+a.networkState+' src='+(a.src?a.src.slice(-20):'(none)')+' path='+audioPath.get(uuid));
|
||||
}
|
||||
logLine('', 'applyAudioMute silenced='+silenced+' touched='+touched);
|
||||
}
|
||||
function streamUrlFor(pubHex){
|
||||
return SFU_BASE + '/stream?room=' + encodeURIComponent(roomID) + '&pub=' + pubHex;
|
||||
|
|
@ -4926,8 +4932,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">8a8a289a9c7301537a899c53e1f6b762</span><br>
|
||||
sha256 <span class="stamp-sha">740fb758e0de907972a277b4f961ea21b978d76e980b853f4a616954ab7c0e47</span><br>
|
||||
md5 <span class="stamp-md5">71493d3cbf0438797dcf8c1b4948202f</span><br>
|
||||
sha256 <span class="stamp-sha">2a12f6f390f0592daa5ee6ad23f8a661d558ece7a57cce51567ddc34adc89a7d</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