diff --git a/hooks/useLiveKitRoom.ts b/hooks/useLiveKitRoom.ts index 8841213..85282ee 100644 --- a/hooks/useLiveKitRoom.ts +++ b/hooks/useLiveKitRoom.ts @@ -435,6 +435,19 @@ export function useLiveKitRoom(options: UseLiveKitRoomOptions): UseLiveKitRoomRe logSuccess('Connected to room!'); + // ========== CRITICAL: Start Audio Playback ========== + // This is REQUIRED for audio to play on iOS and Android! + // Without this call, remote audio tracks will NOT be heard. + logInfo('Starting audio playback (room.startAudio)...'); + try { + await lkRoom.startAudio(); + logSuccess(`Audio playback started! canPlaybackAudio: ${lkRoom.canPlaybackAudio}`); + setCanPlayAudio(lkRoom.canPlaybackAudio); + } catch (audioPlaybackErr: any) { + logError(`startAudio failed: ${audioPlaybackErr.message}`); + // Don't fail the whole call - audio might still work on some platforms + } + // Check if connection was cancelled after connect if (isUnmountingRef.current || currentConnectionId !== connectionIdRef.current) { logWarn('Connection cancelled after room.connect()');