diff --git a/packages/stream_video_flutter/lib/src/call_participants/call_participants.dart b/packages/stream_video_flutter/lib/src/call_participants/call_participants.dart index 10210ee3..31810fe7 100644 --- a/packages/stream_video_flutter/lib/src/call_participants/call_participants.dart +++ b/packages/stream_video_flutter/lib/src/call_participants/call_participants.dart @@ -132,18 +132,8 @@ class _StreamCallParticipantsState extends State { final screenShareTrack = it.screenShareTrack; final isScreenShareEnabled = it.isScreenShareEnabled; - // If the screen share track is local, we don't have to subscribe to - // anything and we can directly use the mute state. - if (screenShareTrack is! RemoteTrackState) return isScreenShareEnabled; - - // If the screen share track is remote and already subscribed and - // received, we can directly use the mute state. - if (screenShareTrack.subscribed && screenShareTrack.received) { - return isScreenShareEnabled; - } - - // If it's not yet subscribed, we have to show it in order for it to - // start the subscription process. + if (screenShareTrack == null || !isScreenShareEnabled) return false; + return true; }, ); diff --git a/packages/stream_video_flutter/lib/src/call_participants/regular_call_participants_content.dart b/packages/stream_video_flutter/lib/src/call_participants/regular_call_participants_content.dart index 5f6d4197..ca19b2d7 100644 --- a/packages/stream_video_flutter/lib/src/call_participants/regular_call_participants_content.dart +++ b/packages/stream_video_flutter/lib/src/call_participants/regular_call_participants_content.dart @@ -43,9 +43,7 @@ class RegularCallParticipantsContent extends StatelessWidget { CallParticipantState participant, ) { return StreamCallParticipant( - // We use the sessionId as the key to avoid rebuilding the widget - // when the participant changes. - key: ValueKey(participant.sessionId), + key: ValueKey(participant.userId), call: call, participant: participant, ); diff --git a/packages/stream_video_flutter/lib/src/call_participants/screen_share_call_participants_content.dart b/packages/stream_video_flutter/lib/src/call_participants/screen_share_call_participants_content.dart index 2b3f9995..a88ce469 100644 --- a/packages/stream_video_flutter/lib/src/call_participants/screen_share_call_participants_content.dart +++ b/packages/stream_video_flutter/lib/src/call_participants/screen_share_call_participants_content.dart @@ -38,9 +38,7 @@ class ScreenShareCallParticipantsContent extends StatelessWidget { CallParticipantState participant, ) { return StreamCallParticipant( - // We use the sessionId as the key to avoid rebuilding the widget - // when the participant changes. - key: ValueKey(participant.sessionId), + key: ValueKey(participant.userId), call: call, participant: participant, ); @@ -67,7 +65,7 @@ class ScreenShareCallParticipantsContent extends StatelessWidget { return Stack( children: [ ScreenShareContent( - key: ValueKey('${participant.sessionId} - screenShareContent'), + key: ValueKey('${participant.userId} - screenShareContent'), call: call, participant: participant, ), diff --git a/packages/stream_video_flutter/lib/src/renderer/video_renderer.dart b/packages/stream_video_flutter/lib/src/renderer/video_renderer.dart index b825492b..c023f16b 100644 --- a/packages/stream_video_flutter/lib/src/renderer/video_renderer.dart +++ b/packages/stream_video_flutter/lib/src/renderer/video_renderer.dart @@ -58,7 +58,7 @@ class StreamVideoRenderer extends StatelessWidget { } return VisibilityDetector( - key: Key('${participant.sessionId}${trackState?.muted}'), + key: Key('${participant.userId}${participant.sessionId}$videoTrackType${trackState?.muted}'), onVisibilityChanged: _onVisibilityChanged, child: child, );