From 41accdba8156ad772056d060be6bae8008ecb729 Mon Sep 17 00:00:00 2001 From: help4bis Date: Fri, 3 Apr 2026 07:09:17 +1000 Subject: [PATCH] =?UTF-8?q?fix:=20remote=20video=20stuck=20on=20'waiting'?= =?UTF-8?q?=20=E2=80=94=20widget=20never=20rebuilt=20after=20connect?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit _RemoteVideoView watched liveKitServiceProvider which returns the same keepAlive instance. When activeRoom was set after connecting, Riverpod didn't detect the field change so the widget stayed on the null path. Fix: also watch callControllerProvider — when state transitions from Connecting to Active, the widget rebuilds and finds activeRoom non-null, then ListenableBuilder takes over for participant/track changes. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/features/calls/presentation/call_screen.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/features/calls/presentation/call_screen.dart b/lib/features/calls/presentation/call_screen.dart index d5d5dc7..40af8e3 100644 --- a/lib/features/calls/presentation/call_screen.dart +++ b/lib/features/calls/presentation/call_screen.dart @@ -109,11 +109,15 @@ class _CallScreenState extends ConsumerState { /// Listens to the LiveKit Room's ChangeNotifier so it rebuilds when /// remote participants join/leave or publish/unpublish tracks. +/// Also watches callControllerProvider so it rebuilds when the call state +/// transitions (connecting → active) — that's when activeRoom becomes non-null. class _RemoteVideoView extends ConsumerWidget { const _RemoteVideoView(); @override Widget build(BuildContext context, WidgetRef ref) { + // Watch call state to trigger rebuild when call connects. + ref.watch(callControllerProvider); final room = ref.watch(liveKitServiceProvider).activeRoom; if (room == null) { return const _NoVideoPlaceholder(); @@ -154,6 +158,7 @@ class _LocalVideoPip extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + ref.watch(callControllerProvider); // rebuild when call state changes final room = ref.watch(liveKitServiceProvider).activeRoom; if (room == null) return const SizedBox.shrink();