diff --git a/lib/providers/content/call.dart b/lib/providers/content/call.dart index e243487..b67f097 100644 --- a/lib/providers/content/call.dart +++ b/lib/providers/content/call.dart @@ -34,7 +34,7 @@ class ChatCallProvider extends GetxController { late Room room; late EventsListener listener; - RxList participantTracks = [].obs; + RxList participantTracks = RxList.empty(growable: true); Rx focusTrack = Rx(null); Future checkPermissions() async { @@ -194,7 +194,7 @@ class ChatCallProvider extends GetxController { } } - final newTracks = List.empty(growable: true); + final newTracks = List.empty(growable: true); final mediaTrackList = mediaTracks.values.toList(); mediaTrackList.sort((a, b) { @@ -247,6 +247,15 @@ class ChatCallProvider extends GetxController { } participantTracks.value = newTracks; + + if (focusTrack.value != null) { + final idx = participantTracks.indexWhere( + (x) => x.participant.sid == focusTrack.value!.participant.sid); + if (idx == -1) { + focusTrack.value = null; + } + } + if (focusTrack.value == null) { focusTrack.value = participantTracks.firstOrNull; } else {