SHA256
Исправить интерфейс видеозвонка
This commit is contained in:
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
client.version=1.20.82
|
client.version=1.20.83
|
||||||
server.version=1.16.51
|
server.version=1.16.51
|
||||||
|
|||||||
@@ -43,6 +43,10 @@
|
|||||||
|
|
||||||
Макеты намеренно изолированы от `shine-UI`: они не импортируют приложение и не участвуют в его сборке. Здесь допускаются экспериментальные компоненты; при переносе утверждённого дизайна нужно использовать существующие владельцы AppShell, TopBar, Dropdown, Avatar и Composer.
|
Макеты намеренно изолированы от `shine-UI`: они не импортируют приложение и не участвуют в его сборке. Здесь допускаются экспериментальные компоненты; при переносе утверждённого дизайна нужно использовать существующие владельцы AppShell, TopBar, Dropdown, Avatar и Composer.
|
||||||
|
|
||||||
|
## Звонки
|
||||||
|
|
||||||
|
Во входящем звонке действия отображаются круглыми иконками: ответ — зелёной трубкой, отклонение — красной. При выключении видео собеседником видеотрек перестаёт передаваться, а интерфейс возвращается к обычному экрану звонка с аватаром и данными собеседника; чёрная заглушка вместо видео не используется.
|
||||||
|
|
||||||
## Проверка
|
## Проверка
|
||||||
|
|
||||||
Результаты проверки и ограничения приведены в [VALIDATION.md](VALIDATION.md). Визуальная проверка в браузере в текущей сессии недоступна: подключённых браузеров нет. Это рабочие HTML-макеты для обсуждения, не проверенная на устройствах реализация приложения.
|
Результаты проверки и ограничения приведены в [VALIDATION.md](VALIDATION.md). Визуальная проверка в браузере в текущей сессии недоступна: подключённых браузеров нет. Это рабочие HTML-макеты для обсуждения, не проверенная на устройствах реализация приложения.
|
||||||
|
|||||||
@@ -2265,34 +2265,20 @@ async function applyCameraState(call) {
|
|||||||
videoTrack.enabled = true;
|
videoTrack.enabled = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const blackTrack = ensureBlackVideoTrack(call);
|
|
||||||
if (hadSlotBefore) {
|
if (hadSlotBefore) {
|
||||||
if (call.localStream && blackTrack) {
|
|
||||||
const existingVideoTracks = call.localStream.getVideoTracks?.() || [];
|
|
||||||
existingVideoTracks.forEach((track) => {
|
|
||||||
if (track.id !== blackTrack.id) {
|
|
||||||
try { call.localStream.removeTrack(track); } catch {}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (!existingVideoTracks.some((track) => track.id === blackTrack.id)) {
|
|
||||||
call.localStream.addTrack(blackTrack);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (videoTransceiver && videoTransceiver.direction !== 'sendrecv') {
|
if (videoTransceiver && videoTransceiver.direction !== 'sendrecv') {
|
||||||
videoTransceiver.direction = 'sendrecv';
|
videoTransceiver.direction = 'sendrecv';
|
||||||
}
|
}
|
||||||
} catch {}
|
} catch {}
|
||||||
if (videoTransceiver?.sender) {
|
if (videoTransceiver?.sender) {
|
||||||
try { await videoTransceiver.sender.replaceTrack(blackTrack || null); } catch {}
|
// A black placeholder is still an active video track for the peer and leaves
|
||||||
|
// its call UI on a black screen. Removing the source makes the remote track
|
||||||
|
// mute, which restores the regular avatar call stage until video returns.
|
||||||
|
try { await videoTransceiver.sender.replaceTrack(null); } catch {}
|
||||||
call.videoSender = videoTransceiver.sender;
|
call.videoSender = videoTransceiver.sender;
|
||||||
bindVideoSenderStream(call, videoTransceiver.sender);
|
|
||||||
await applyVideoSenderEncodingProfile(videoTransceiver.sender, 'placeholder');
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (call.localStream && blackTrack) {
|
|
||||||
syncLocalStreamVideoTrack(call, blackTrack, { stopRemoved: false });
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if (videoTransceiver && videoTransceiver.direction !== 'sendrecv') {
|
if (videoTransceiver && videoTransceiver.direction !== 'sendrecv') {
|
||||||
videoTransceiver.direction = 'sendrecv';
|
videoTransceiver.direction = 'sendrecv';
|
||||||
@@ -2301,8 +2287,6 @@ async function applyCameraState(call) {
|
|||||||
if (hadReservedBefore && videoTransceiver?.sender) {
|
if (hadReservedBefore && videoTransceiver?.sender) {
|
||||||
try { await videoTransceiver.sender.replaceTrack(null); } catch {}
|
try { await videoTransceiver.sender.replaceTrack(null); } catch {}
|
||||||
call.videoSender = videoTransceiver.sender;
|
call.videoSender = videoTransceiver.sender;
|
||||||
} else if (call.videoTransportMode === VIDEO_TRANSPORT_SLOT && blackTrack) {
|
|
||||||
await ensureVideoSenderSlot(call, { sourceTrack: blackTrack, profile: 'placeholder' });
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await disableCameraTrack(call);
|
await disableCameraTrack(call);
|
||||||
|
|||||||
@@ -166,7 +166,10 @@ function getIconSvg(name) {
|
|||||||
return '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="3.5" width="6" height="11" rx="3" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M6 11.5a6 6 0 0 0 7.2 5.88" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 17.5v3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M8.5 20.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M5 5l14 14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>';
|
return '<svg viewBox="0 0 24 24" aria-hidden="true"><rect x="9" y="3.5" width="6" height="11" rx="3" fill="none" stroke="currentColor" stroke-width="1.8"/><path d="M6 11.5a6 6 0 0 0 7.2 5.88" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M12 17.5v3" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M8.5 20.5h7" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"/><path d="M5 5l14 14" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round"/></svg>';
|
||||||
}
|
}
|
||||||
if (name === 'hangup') {
|
if (name === 'hangup') {
|
||||||
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M7 7l10 10M17 7 7 17" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"/></svg>';
|
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5.1 8.5c3.8-3.1 10-3.1 13.8 0l-2 2.4a1.3 1.3 0 0 1-1.6.3l-1.6-.8a1.3 1.3 0 0 0-1.2 0l-1.6.8a1.3 1.3 0 0 1-1.6-.3z" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
||||||
|
}
|
||||||
|
if (name === 'answer') {
|
||||||
|
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5.1 8.5c3.8-3.1 10-3.1 13.8 0l-2 2.4a1.3 1.3 0 0 1-1.6.3l-1.6-.8a1.3 1.3 0 0 0-1.2 0l-1.6.8a1.3 1.3 0 0 1-1.6-.3z" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" transform="rotate(180 12 12)"/></svg>';
|
||||||
}
|
}
|
||||||
if (name === 'minimize') {
|
if (name === 'minimize') {
|
||||||
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 6v12M7.5 10.5 12 6l4.5 4.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 6v12M7.5 10.5 12 6l4.5 4.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
||||||
@@ -455,16 +458,16 @@ function ensureUi() {
|
|||||||
|
|
||||||
acceptBtn = document.createElement('button');
|
acceptBtn = document.createElement('button');
|
||||||
acceptBtn.type = 'button';
|
acceptBtn.type = 'button';
|
||||||
acceptBtn.className = 'call-accept-btn';
|
acceptBtn.className = 'call-call-action-btn call-call-action-btn--accept';
|
||||||
acceptBtn.textContent = t('remaining.call_ui.answer');
|
setButtonIcon(acceptBtn, 'answer', t('remaining.call_ui.answer'));
|
||||||
acceptBtn.addEventListener('click', async () => {
|
acceptBtn.addEventListener('click', async () => {
|
||||||
await acceptIncomingCall();
|
await acceptIncomingCall();
|
||||||
});
|
});
|
||||||
|
|
||||||
declineBtn = document.createElement('button');
|
declineBtn = document.createElement('button');
|
||||||
declineBtn.type = 'button';
|
declineBtn.type = 'button';
|
||||||
declineBtn.className = 'destructive-btn call-decline-btn';
|
declineBtn.className = 'call-call-action-btn call-call-action-btn--decline';
|
||||||
declineBtn.textContent = t('remaining.call_ui.decline');
|
setButtonIcon(declineBtn, 'hangup', t('remaining.call_ui.decline'));
|
||||||
declineBtn.addEventListener('click', async () => {
|
declineBtn.addEventListener('click', async () => {
|
||||||
await declineIncomingCall();
|
await declineIncomingCall();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -407,8 +407,7 @@
|
|||||||
.call-overlay-controls--incoming[hidden],
|
.call-overlay-controls--incoming[hidden],
|
||||||
.call-overlay-controls--active[hidden],
|
.call-overlay-controls--active[hidden],
|
||||||
.call-icon-btn[hidden],
|
.call-icon-btn[hidden],
|
||||||
.call-accept-btn[hidden],
|
.call-call-action-btn[hidden],
|
||||||
.call-decline-btn[hidden],
|
|
||||||
.call-minimized-bar-actions[hidden] {
|
.call-minimized-bar-actions[hidden] {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
@@ -426,81 +425,54 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
.call-decline-btn {
|
.call-call-action-btn {
|
||||||
min-width: 132px;
|
width: 64px;
|
||||||
}
|
min-width: 64px;
|
||||||
|
height: 64px;
|
||||||
|
padding: 0;
|
||||||
.call-accept-btn {
|
|
||||||
min-width: 132px;
|
|
||||||
min-height: 38px;
|
|
||||||
padding: 9px 12px;
|
|
||||||
border: 0;
|
border: 0;
|
||||||
border-radius: var(--radius-sm);
|
border-radius: 50%;
|
||||||
background: transparent;
|
color: #fff;
|
||||||
background-image: none;
|
box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28);
|
||||||
box-shadow: none;
|
|
||||||
color: var(--text-primary);
|
|
||||||
text-shadow: none;
|
|
||||||
backdrop-filter: none;
|
|
||||||
-webkit-backdrop-filter: none;
|
|
||||||
font-weight: 700;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: transform 90ms ease, box-shadow 90ms ease, background-color 90ms ease, filter 120ms ease;
|
transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.call-call-action-btn--accept {
|
||||||
|
background: var(--success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.call-call-action-btn--decline {
|
||||||
|
background: var(--danger);
|
||||||
|
}
|
||||||
|
|
||||||
|
.call-call-action-btn svg {
|
||||||
|
width: 31px;
|
||||||
|
height: 31px;
|
||||||
|
}
|
||||||
|
|
||||||
@media (hover: hover) {
|
@media (hover: hover) {
|
||||||
.call-accept-btn:hover {
|
.call-call-action-btn:hover {
|
||||||
color: var(--text-primary);
|
transform: translateY(-2px) scale(1.03);
|
||||||
background: transparent;
|
filter: brightness(1.08);
|
||||||
border: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
transform: translateY(-1px);
|
|
||||||
filter: brightness(1.12);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.call-call-action-btn:active {
|
||||||
.call-accept-btn:active {
|
transform: scale(0.94);
|
||||||
color: var(--text-primary);
|
|
||||||
background: color-mix(in srgb, var(--surface) 12%, transparent);
|
|
||||||
border: 0;
|
|
||||||
box-shadow:
|
|
||||||
inset 0 3px 8px rgba(0, 0, 0, 0.58),
|
|
||||||
inset 0 -1px 2px color-mix(in srgb, var(--text-primary) 8%, transparent);
|
|
||||||
transform: translateY(1px) scale(0.97);
|
|
||||||
filter: brightness(0.9);
|
filter: brightness(0.9);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.call-call-action-btn:disabled {
|
||||||
.call-accept-btn:disabled {
|
opacity: 0.55;
|
||||||
opacity: 1;
|
|
||||||
color: var(--text-secondary);
|
|
||||||
background: transparent;
|
|
||||||
border: 0;
|
|
||||||
box-shadow: none;
|
|
||||||
cursor: not-allowed;
|
cursor: not-allowed;
|
||||||
transform: none;
|
|
||||||
filter: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.call-call-action-btn:focus-visible {
|
||||||
.call-accept-btn:focus-visible {
|
outline: 2px solid var(--text-primary);
|
||||||
outline: 2px solid var(--border-control);
|
|
||||||
outline-offset: 2px;
|
outline-offset: 2px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.call-accept-btn::before,
|
|
||||||
.call-accept-btn::after {
|
|
||||||
background: transparent;
|
|
||||||
background-image: none;
|
|
||||||
border-color: transparent;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@media (max-width: 420px) {
|
@media (max-width: 420px) {
|
||||||
.call-overlay-controls {
|
.call-overlay-controls {
|
||||||
gap: 16px;
|
gap: 16px;
|
||||||
@@ -516,8 +488,9 @@
|
|||||||
width: 22px;
|
width: 22px;
|
||||||
height: 22px;
|
height: 22px;
|
||||||
}
|
}
|
||||||
.call-accept-btn,
|
.call-call-action-btn {
|
||||||
.call-decline-btn {
|
width: 58px;
|
||||||
min-width: 124px;
|
min-width: 58px;
|
||||||
|
height: 58px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import test from 'node:test';
|
||||||
|
import assert from 'node:assert/strict';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
|
||||||
|
const read = (relative) => fs.readFileSync(new URL(relative, import.meta.url), 'utf8');
|
||||||
|
|
||||||
|
test('входящий звонок использует зелёную и красную кнопки с иконками трубки', () => {
|
||||||
|
const ui = read('../js/services/call-ui-service.js');
|
||||||
|
const css = read('../styles/components/call-ui.css');
|
||||||
|
assert.match(ui, /setButtonIcon\(acceptBtn, 'answer', t\('remaining\.call_ui\.answer'\)\)/);
|
||||||
|
assert.match(ui, /setButtonIcon\(declineBtn, 'hangup', t\('remaining\.call_ui\.decline'\)\)/);
|
||||||
|
assert.match(css, /\.call-call-action-btn--accept\s*\{\s*background: var\(--success\)/);
|
||||||
|
assert.match(css, /\.call-call-action-btn--decline\s*\{\s*background: var\(--danger\)/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('выключение камеры не передаёт чёрную видеозаглушку собеседнику', () => {
|
||||||
|
const service = read('../js/services/call-service.js');
|
||||||
|
const disabledSlot = service.slice(service.indexOf(' } else {\n if (hadSlotBefore)'), service.indexOf(' await disableCameraTrack(call);'));
|
||||||
|
assert.match(disabledSlot, /videoTransceiver\.sender\.replaceTrack\(null\)/);
|
||||||
|
assert.doesNotMatch(disabledSlot, /ensureBlackVideoTrack\(call\)/);
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user