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 && (