aboutsummaryrefslogtreecommitdiffstats
path: root/src/features
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-10-18 23:19:11 -0700
committerAdam Soltys <[email protected]>2026-10-18 23:19:11 -0700
commitd007dbec5d44963b4650baf9668389ec7da944f3 (patch)
treeb93a4adcccdf4031a9b7239ff8aa38e67c901d97 /src/features
parentdb3eda32859130781ee25aa462f2ae5839f3feb3 (diff)
downloadcoinosv3-d007dbec5d44963b4650baf9668389ec7da944f3.tar.gz
coinosv3-d007dbec5d44963b4650baf9668389ec7da944f3.zip
A voice call can turn video: Turn on camera in the call's bar puts your camera in (a renegotiation, NIP-AC's kind 25055); the other side sees you at once and gets the same button for theirs. The call's sound carries on throughout.
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg
Diffstat (limited to 'src/features')
-rw-r--r--src/features/messages.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 9604f6e..887f327 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -9532,6 +9532,7 @@ export function messagesFeature(ctx) {
if (c.state === 'connected') setTimeout(scheduleRepaint, 1000); // the clock
const video = c.type === 'video';
const remoteVideo = video && c.remote && c.remote.getVideoTracks().length > 0;
+ const camOn = !!c.local && c.local.getVideoTracks().length > 0;
const sound = h('audio', { class: 'call-audio', 'data-key': 'call-audio:' + c.id, autoplay: '' });
const status = c.state === 'incoming' ? t(video ? 'callIncomingVideo' : 'callIncomingVoice')
: c.state === 'starting' || c.state === 'offering' ? t('callCalling')
@@ -9551,7 +9552,7 @@ export function messagesFeature(ctx) {
avatar(c.peer, 'chat-avatar profile-avatar call-avatar', false),
h('div', { class: 'call-name' }, displayName(c.peer)),
h('div', { class: 'call-status' }, status)),
- video && c.local ? h('video', { class: 'call-local' + (c.facing === 'user' ? ' mirror' : ''), 'data-key': 'call-local:' + c.id, autoplay: '', playsinline: '', muted: '' }) : null,
+ video && c.local && c.local.getVideoTracks().length ? h('video', { class: 'call-local' + (c.facing === 'user' ? ' mirror' : ''), 'data-key': 'call-local:' + c.id, autoplay: '', playsinline: '', muted: '' }) : null,
c.state === 'incoming'
? h('div', { class: 'call-bar' },
btn('call-decline', 'hang', t('callDecline'), () => callsNow().reject()),
@@ -9559,8 +9560,11 @@ export function messagesFeature(ctx) {
: c.state === 'ended' ? null
: h('div', { class: 'call-bar' },
btn('', c.muted ? 'micOff' : 'mic', t(c.muted ? 'callUnmute' : 'callMute'), () => callsNow().setMuted(!c.muted), c.muted),
- video ? btn('', c.camOff ? 'camOff' : 'video', t(c.camOff ? 'callCamOn' : 'callCamOff'), () => callsNow().setCamOff(!c.camOff), c.camOff) : null,
- video ? btn('', 'flip', t('callFlip'), () => callsNow().flip()) : null,
+ // a camera in the call: off/on and flip; none yet (a voice call, or
+ // theirs came on first): one tap puts ours in
+ camOn ? btn('', c.camOff ? 'camOff' : 'video', t(c.camOff ? 'callCamOn' : 'callCamOff'), () => callsNow().setCamOff(!c.camOff), c.camOff) : null,
+ camOn ? btn('', 'flip', t('callFlip'), () => callsNow().flip()) : null,
+ !camOn && c.state === 'connected' ? btn('call-add-video', 'video', t('callAddVideo'), () => callsNow().addVideo()) : null,
btn('', 'min', t('callMinimize'), () => { ui.callMin = true; render(); }),
btn('call-hang', 'hang', t('callHangUp'), () => callsNow().hangup())));
}