From 820a7bec6ad2ce06e3c4373c7b4972f9306e2001 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A5=D0=B0=D0=BB=D0=B8=D0=BC=D0=BE=D0=B2=20=D0=A0=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BC?= Date: Wed, 11 Mar 2026 16:45:08 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=B5=D1=81=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/web/src/components/CallModal.tsx | 30 ++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/apps/web/src/components/CallModal.tsx b/apps/web/src/components/CallModal.tsx index a2ea091..dce11c9 100644 --- a/apps/web/src/components/CallModal.tsx +++ b/apps/web/src/components/CallModal.tsx @@ -122,6 +122,7 @@ export default function CallModal({ isOpen, onClose, targetUser, callType: initi const [activeCameraId, setActiveCameraId] = useState(''); const [remoteVolume, setRemoteVolume] = useState(1); const [showVolumeSlider, setShowVolumeSlider] = useState(false); + const [needsInteraction, setNeedsInteraction] = useState(false); const [noiseSuppression, setNoiseSuppression] = useState(false); const [microphones, setMicrophones] = useState([]); const [activeMicId, setActiveMicId] = useState(''); @@ -294,9 +295,12 @@ export default function CallModal({ isOpen, onClose, targetUser, callType: initi } // Important: Unmute for remote audio to work remoteVideoRef.current.muted = false; - remoteVideoRef.current.play().catch(e => { - console.warn('[WebRTC] Play failed, waiting for user interaction:', e); - }); + remoteVideoRef.current.play() + .then(() => setNeedsInteraction(false)) + .catch(e => { + console.warn('[WebRTC] Play failed, waiting for user interaction:', e); + setNeedsInteraction(true); + }); } track.onunmute = checkVideo; @@ -1611,6 +1615,26 @@ export default function CallModal({ isOpen, onClose, targetUser, callType: initi )} + {/* Autoplay block overlay */} + {needsInteraction && hasRemoteVideo && ( +
+ +

Браузер заблокировал автоматический запуск

+
+ )} + {/* Local video PIP (bottom-right) */} {hasLocalVideo && (