zebra-spaces: surface getDisplayMedia audio-track count + browser-specific hint

Firefox getDisplayMedia silently drops audio for window/tab sources (only
'entire screen' carries system audio). Users were broadcasting video-only
without knowing the audio never made it into the captured stream.

Log the captured track counts unconditionally; when audio is 0 explain
the limitation per browser and point to the workaround (route the tab
through mic music mode for high-quality stereo broadcast).
This commit is contained in:
Russell Ballestrini 2026-06-01 20:27:38 -04:00
parent 6fbeade12d
commit 1294e96f01
No known key found for this signature in database

View file

@ -733,6 +733,20 @@ async function sfuPublishScreen(){
});
} catch(e){ logLine('err','screen share cancelled: '+e.message); return; }
sfuScreenStream = stream;
const vTracks = stream.getVideoTracks(), aTracks = stream.getAudioTracks();
logLine('', 'screen capture: '+vTracks.length+' video + '+aTracks.length+' audio track(s)');
if (aTracks.length === 0){
/* Firefox getDisplayMedia never captures tab/window audio — only the
* 'entire screen' source carries system audio, and only on some
* platforms. Chrome captures tab audio when the user ticks 'share
* audio' in the picker. Make the limitation visible instead of
* silently broadcasting video-only. */
const ua = navigator.userAgent;
const ff = /Firefox/.test(ua);
logLine('err','no audio captured — '+(ff
? 'Firefox getDisplayMedia ignores tab/window audio. Share "entire screen" with system audio, or stream the audio via mic music mode (toggle music mode + route the tab through your mic).'
: 'tick the "share tab/system audio" checkbox in the picker, or use music-mode mic.'));
}
const pc = new RTCPeerConnection(rtcConfig);
for (const tr of stream.getTracks()){
if (tr.kind === 'video') tr.contentHint = 'detail'; /* favour pixel fidelity over framerate */
@ -1693,8 +1707,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-02</span><br>
md5 <span class="stamp-md5">dcf58a2cc3ae320f3d73da16ea79471b</span><br>
sha256 <span class="stamp-sha">5bc64c4b97bf6a3426ca2b682da978c8950689e198b8b9c3fab8f554ede05733</span><br>
md5 <span class="stamp-md5">fe091219cd9ca42891eba2c5eeee35f3</span><br>
sha256 <span class="stamp-sha">e5e7f467ae1a8badf689cbe653fe1b5607aff0eff1c92ce70be61eca616ae57a</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>