Skip to content

Commit 109ecf1

Browse files
authored
fixed members collection (#1092)
1 parent 69c549d commit 109ecf1

File tree

5 files changed

+42
-37
lines changed

5 files changed

+42
-37
lines changed

packages/stream_video/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Web] Fixed changing the output audio device during the call.
66
- [Android/iOS] Fixed an issue where screen sharing was not stopped correctly when canceled via the system UI on Android or iOS.
77
- [iOS] Improved broadcast extension handling — the app now waits for the broadcast picker selection before actually starting screen sharing.
8+
- Fixed an issue where `callMembers` collection wasn't reflecting the actual members list after starting the call session.
89

910
✅ Added
1011
- [Web] Added `checkIfAudioOutputChangeSupported()` to the `Call` class to check whether the browser supports changing the audio output device.

packages/stream_video/lib/src/call/call.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,9 +613,15 @@ class Call {
613613
case StreamCallMissedEvent _:
614614
return _stateManager.callMetadataChanged(event.metadata);
615615
case StreamCallSessionEndedEvent _:
616-
return _stateManager.callMetadataChanged(event.metadata);
616+
return _stateManager.callMetadataChanged(
617+
event.metadata,
618+
updateMembers: false,
619+
);
617620
case StreamCallSessionStartedEvent _:
618-
return _stateManager.callMetadataChanged(event.metadata);
621+
return _stateManager.callMetadataChanged(
622+
event.metadata,
623+
updateMembers: false,
624+
);
619625
default:
620626
break;
621627
}

packages/stream_video/lib/src/call/state/mixins/state_coordinator_mixin.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ mixin StateCoordinatorMixin on StateNotifier<CallState> {
1717
void callMetadataChanged(
1818
CallMetadata callMetadata, {
1919
Map<String, List<String>>? capabilitiesByRole,
20+
bool updateMembers = true,
2021
}) {
2122
state = state.copyFromMetadata(
2223
callMetadata,
2324
capabilitiesByRole: capabilitiesByRole,
25+
updateMembers: updateMembers,
2426
);
2527
}
2628

packages/stream_video/lib/src/call/state/mixins/state_lifecycle_mixin.dart

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -111,35 +111,31 @@ mixin StateLifecycleMixin on StateNotifier<CallState> {
111111
}) {
112112
_logWithState('lifecycleCallCreated', 'ringing: $ringing');
113113

114-
state = state
115-
.copyFromMetadata(
116-
data.metadata,
117-
)
118-
.copyWith(
119-
status: data.toCallStatus(state: state, ringing: ringing),
120-
callParticipants: data.metadata.toCallParticipants(state),
121-
isRingingFlow: ringing,
122-
audioOutputDevice: callConnectOptions.audioOutputDevice,
123-
audioInputDevice: callConnectOptions.audioInputDevice,
124-
videoInputDevice: callConnectOptions.videoInputDevice,
125-
);
114+
final newState = state.copyFromMetadata(data.metadata);
115+
116+
state = newState.copyWith(
117+
status: data.toCallStatus(state: newState, ringing: ringing),
118+
callParticipants: data.metadata.toCallParticipants(newState),
119+
isRingingFlow: ringing,
120+
audioOutputDevice: callConnectOptions.audioOutputDevice,
121+
audioInputDevice: callConnectOptions.audioInputDevice,
122+
videoInputDevice: callConnectOptions.videoInputDevice,
123+
);
126124
}
127125

128126
void lifecycleCallRinging(
129127
CallRingingData data,
130128
) {
131129
_logWithState('lifecycleCallRinging');
132130

133-
state = state
134-
.copyFromMetadata(
135-
data.metadata,
136-
)
137-
.copyWith(
138-
status: data.toCallStatus(state: state),
139-
isRingingFlow: data.ringing,
140-
ownCapabilities: data.metadata.details.ownCapabilities.toList(),
141-
callParticipants: data.metadata.toCallParticipants(state),
142-
);
131+
final newState = state.copyFromMetadata(data.metadata);
132+
133+
state = newState.copyWith(
134+
status: data.toCallStatus(state: newState),
135+
isRingingFlow: data.ringing,
136+
ownCapabilities: data.metadata.details.ownCapabilities.toList(),
137+
callParticipants: data.metadata.toCallParticipants(newState),
138+
);
143139
}
144140

145141
void lifecycleCallJoining() {
@@ -157,18 +153,16 @@ mixin StateLifecycleMixin on StateNotifier<CallState> {
157153
final status = state.status.isJoining ? CallStatus.joined() : state.status;
158154
_logWithState('lifecycleCallJoined', 'newStatus: $status');
159155

160-
state = state
161-
.copyFromMetadata(
162-
data.metadata,
163-
)
164-
.copyWith(
165-
status: status,
166-
ownCapabilities: data.metadata.details.ownCapabilities.toList(),
167-
callParticipants: data.metadata.toCallParticipants(state),
168-
audioOutputDevice: callConnectOptions?.audioOutputDevice,
169-
audioInputDevice: callConnectOptions?.audioInputDevice,
170-
videoInputDevice: callConnectOptions?.videoInputDevice,
171-
);
156+
final newState = state.copyFromMetadata(data.metadata);
157+
158+
state = newState.copyWith(
159+
status: status,
160+
ownCapabilities: data.metadata.details.ownCapabilities.toList(),
161+
callParticipants: data.metadata.toCallParticipants(newState),
162+
audioOutputDevice: callConnectOptions?.audioOutputDevice,
163+
audioInputDevice: callConnectOptions?.audioInputDevice,
164+
videoInputDevice: callConnectOptions?.videoInputDevice,
165+
);
172166
}
173167

174168
void lifecycleCallReconnectingFailed() {

packages/stream_video/lib/src/call_state.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ class CallState extends Equatable {
248248
CallState copyFromMetadata(
249249
CallMetadata metadata, {
250250
Map<String, List<String>>? capabilitiesByRole,
251+
bool updateMembers = true,
251252
}) {
252253
final capabilities = metadata.details.ownCapabilities.toList();
253254

@@ -273,7 +274,7 @@ class CallState extends Equatable {
273274
liveEndedAt: metadata.session.liveEndedAt,
274275
timerEndsAt: metadata.session.timerEndsAt,
275276
capabilitiesByRole: capabilitiesByRole,
276-
callMembers: metadata.toCallMembers(),
277+
callMembers: updateMembers ? metadata.toCallMembers() : null,
277278
);
278279
}
279280

@@ -298,6 +299,7 @@ class CallState extends Equatable {
298299
audioOutputDevice,
299300
ownCapabilities,
300301
callParticipants,
302+
callMembers,
301303
capabilitiesByRole,
302304
createdAt,
303305
updatedAt,

0 commit comments

Comments
 (0)