zebra-report: telemetry on listener audio path
Mirror of zebra-report f196714.
This commit is contained in:
parent
e8bb5aadbd
commit
013b5c775c
1 changed files with 27 additions and 7 deletions
|
|
@ -4085,20 +4085,32 @@ const audioPath = new Map(); // uuid -> 'dj' | 'rtc'
|
||||||
let listenerOutputMuted = true;
|
let listenerOutputMuted = true;
|
||||||
function applyAudioMute(){
|
function applyAudioMute(){
|
||||||
const silenced = (myRole === 'listener' && listenerOutputMuted);
|
const silenced = (myRole === 'listener' && listenerOutputMuted);
|
||||||
|
let touched = 0, played = 0, failed = 0;
|
||||||
for (const [uuid, a] of remoteAudio){
|
for (const [uuid, a] of remoteAudio){
|
||||||
const wantRtc = !silenced && audioPath.get(uuid) !== 'dj';
|
const wantRtc = !silenced && audioPath.get(uuid) !== 'dj';
|
||||||
try {
|
try {
|
||||||
a.muted = !wantRtc;
|
a.muted = !wantRtc;
|
||||||
if (wantRtc) { const p = a.play(); if (p && p.catch) p.catch(()=>{}); }
|
touched++;
|
||||||
} catch(_){}
|
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); }
|
||||||
}
|
}
|
||||||
for (const [uuid, a] of streamAudio){
|
for (const [uuid, a] of streamAudio){
|
||||||
const wantDj = !silenced && audioPath.get(uuid) === 'dj';
|
const wantDj = !silenced && audioPath.get(uuid) === 'dj';
|
||||||
try {
|
try {
|
||||||
a.muted = !wantDj;
|
a.muted = !wantDj;
|
||||||
if (wantDj) { const p = a.play(); if (p && p.catch) p.catch(()=>{}); }
|
touched++;
|
||||||
} catch(_){}
|
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); }
|
||||||
}
|
}
|
||||||
|
logLine('', 'applyAudioMute silenced='+silenced+' touched='+touched+' streamMode='+streamMode.size);
|
||||||
}
|
}
|
||||||
function streamUrlFor(pubHex){
|
function streamUrlFor(pubHex){
|
||||||
return SFU_BASE + '/stream?room=' + encodeURIComponent(roomID) + '&pub=' + pubHex;
|
return SFU_BASE + '/stream?room=' + encodeURIComponent(roomID) + '&pub=' + pubHex;
|
||||||
|
|
@ -4189,9 +4201,11 @@ function toggleStreamFor(uuid, pubHex){
|
||||||
* - role-change (another peer became a speaker; or we got demoted
|
* - role-change (another peer became a speaker; or we got demoted
|
||||||
* to listener). */
|
* to listener). */
|
||||||
function autoEnableDjModeForListener(){
|
function autoEnableDjModeForListener(){
|
||||||
if (myRole !== 'listener') return;
|
if (myRole !== 'listener') { logLine('', 'autoDJ skip: role='+myRole); return; }
|
||||||
|
let added = 0, seen = 0;
|
||||||
for (const [uuid, mm] of members){
|
for (const [uuid, mm] of members){
|
||||||
if (uuid === myUUID) continue;
|
if (uuid === myUUID) continue;
|
||||||
|
seen++;
|
||||||
if (!canSpeak(mm.role)) continue;
|
if (!canSpeak(mm.role)) continue;
|
||||||
if (!mm.pubkey) continue;
|
if (!mm.pubkey) continue;
|
||||||
let pubHex;
|
let pubHex;
|
||||||
|
|
@ -4199,7 +4213,9 @@ function autoEnableDjModeForListener(){
|
||||||
if (streamMode.has(pubHex)) continue;
|
if (streamMode.has(pubHex)) continue;
|
||||||
streamMode.add(pubHex);
|
streamMode.add(pubHex);
|
||||||
startStream(uuid, pubHex);
|
startStream(uuid, pubHex);
|
||||||
|
added++;
|
||||||
}
|
}
|
||||||
|
logLine('', 'autoDJ pass: members='+seen+' added='+added+' streamMode='+streamMode.size);
|
||||||
}
|
}
|
||||||
/* Periodic retry — covers the timing race where the host's mic publish
|
/* Periodic retry — covers the timing race where the host's mic publish
|
||||||
* hasn't been registered at the SFU yet when the listener first
|
* hasn't been registered at the SFU yet when the listener first
|
||||||
|
|
@ -4646,6 +4662,10 @@ $('btn-mute').addEventListener('click', () => {
|
||||||
* waiting. */
|
* waiting. */
|
||||||
if (myRole === 'listener'){
|
if (myRole === 'listener'){
|
||||||
listenerOutputMuted = !listenerOutputMuted;
|
listenerOutputMuted = !listenerOutputMuted;
|
||||||
|
logLine('', 'play-button: listenerOutputMuted=' + listenerOutputMuted +
|
||||||
|
' remoteAudio=' + remoteAudio.size +
|
||||||
|
' streamAudio=' + streamAudio.size +
|
||||||
|
' audioPath=' + audioPath.size);
|
||||||
applyAudioMute();
|
applyAudioMute();
|
||||||
const btn = $('btn-mute');
|
const btn = $('btn-mute');
|
||||||
btn.textContent = listenerOutputMuted ? 'play' : 'mute';
|
btn.textContent = listenerOutputMuted ? 'play' : 'mute';
|
||||||
|
|
@ -4887,8 +4907,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">
|
<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>
|
<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">63bf820f7f0bc11d4726b3f1550380f6</span><br>
|
md5 <span class="stamp-md5">62e317cdbfd3e536107c394d0380e36c</span><br>
|
||||||
sha256 <span class="stamp-sha">6a259843e45682d391e7485fd11b670eea32b8622846529b3a319f2a375420a8</span><br>
|
sha256 <span class="stamp-sha">4e3cee1e45894ed48628267704c5658fca14da3ca169de4366f69e4c3e48fc0c</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">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>
|
<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>
|
</footer>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue