diff --git a/apps/web/src/components/CallModal.tsx b/apps/web/src/components/CallModal.tsx index dce11c9..3a8f6eb 100644 --- a/apps/web/src/components/CallModal.tsx +++ b/apps/web/src/components/CallModal.tsx @@ -291,15 +291,25 @@ export default function CallModal({ isOpen, onClose, targetUser, callType: initi if (remoteVideoRef.current.srcObject !== stream) { console.log('[WebRTC] Binding stream to video element'); remoteVideoRef.current.srcObject = stream; - remoteVideoRef.current.load(); } - // Important: Unmute for remote audio to work - remoteVideoRef.current.muted = false; + + // Ensure not muted for remote audio + if (remoteVideoRef.current.muted) { + remoteVideoRef.current.muted = false; + } + remoteVideoRef.current.play() - .then(() => setNeedsInteraction(false)) + .then(() => { + console.log('[WebRTC] Playback started successfully'); + setNeedsInteraction(false); + }) .catch(e => { - console.warn('[WebRTC] Play failed, waiting for user interaction:', e); - setNeedsInteraction(true); + if (e.name === 'NotAllowedError' || e.name === 'NotSupportedError') { + console.warn('[WebRTC] Autoplay blocked, waiting for interaction'); + setNeedsInteraction(true); + } else { + console.warn('[WebRTC] Playback failed (non-autoplay error):', e); + } }); } @@ -1621,9 +1631,14 @@ export default function CallModal({ isOpen, onClose, targetUser, callType: initi