fix: remote video stuck on 'waiting' — widget never rebuilt after connect

_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) <noreply@anthropic.com>
This commit is contained in:
2026-04-03 07:09:17 +10:00
parent fa30c1f27c
commit 41accdba81

View File

@@ -109,11 +109,15 @@ class _CallScreenState extends ConsumerState<CallScreen> {
/// 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();