diff --git a/voice-poc/.codesearch/codesearch.db b/voice-poc/.codesearch/codesearch.db index 9e7df26..382a202 100644 Binary files a/voice-poc/.codesearch/codesearch.db and b/voice-poc/.codesearch/codesearch.db differ diff --git a/voice-poc/public/app.js b/voice-poc/public/app.js index 228df45..381639c 100644 --- a/voice-poc/public/app.js +++ b/voice-poc/public/app.js @@ -93,6 +93,7 @@ async function joinVoice(room) { } els.mic.disabled = !S.micStream; S.muted = false; + $('#btn-share').disabled = false; // audio context must exist after a user gesture — the channel click is one if (!S.audioCtx) S.audioCtx = new AudioContext(); @@ -117,6 +118,7 @@ function leaveVoice(reason) { if (S.ws) { try { S.ws.close(); } catch {} S.ws = null; } if (S.micStream) { S.micStream.getTracks().forEach((t) => t.stop()); S.micStream = null; } els.mic.disabled = false; + $('#btn-share').disabled = true; updateMicButton(); document.querySelectorAll('.channel.voice').forEach((c) => c.classList.remove('active')); S.room = null; @@ -402,6 +404,7 @@ async function startScreenShare() { stream.getVideoTracks()[0].addEventListener('ended', () => stopScreenShare()); renderScreens(); renderTiles(); + $('#btn-share').classList.add('active'); toast('You are sharing your screen', 'ok'); } @@ -426,6 +429,7 @@ function stopScreenShare(silent) { send({ type: 'state', state: { muted: S.muted, deafened: S.deafened, sharing: false } }); renderScreens(); renderTiles(); + $('#btn-share').classList.remove('active'); if (!silent) toast('Screen share stopped'); } @@ -703,6 +707,7 @@ function toggleDeafen() { els.mic.onclick = toggleMic; els.deafen.onclick = toggleDeafen; +$('#btn-share').onclick = () => (S.sharing ? stopScreenShare() : startScreenShare()); $('#btn-settings').onclick = openSettings; els.nick.value = S.name; @@ -748,6 +753,7 @@ window.addEventListener('keydown', (ev) => { if (ev.target.tagName === 'INPUT' || ev.target.tagName === 'TEXTAREA') return; if (ev.key === 'm') toggleMic(); if (ev.key === 'd') toggleDeafen(); + if (ev.key === 's' && S.room) $('#btn-share').click(); }); window.addEventListener('beforeunload', () => { try { leaveVoice(); } catch {} }); diff --git a/voice-poc/public/index.html b/voice-poc/public/index.html index f264cbf..321f46b 100644 --- a/voice-poc/public/index.html +++ b/voice-poc/public/index.html @@ -37,6 +37,7 @@
+
@@ -87,6 +88,6 @@
- + diff --git a/voice-poc/public/style.css b/voice-poc/public/style.css index c5bec25..0d7c60e 100644 --- a/voice-poc/public/style.css +++ b/voice-poc/public/style.css @@ -87,6 +87,7 @@ body { background: var(--red); transform: rotate(-40deg); border-radius: 1px; } .ctl:disabled { opacity: .35; cursor: not-allowed; } +.ctl.active { color: var(--green); } /* main */ #main { flex: 1; display: flex; flex-direction: column; min-width: 0; }