Skip to content

Commit c9a01cf

Browse files
authored
fix(llc): fixes in the muteUsers api calls (#1026)
* fixes in the muteUsers api calls * changelog added
1 parent 7b782aa commit c9a01cf

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

packages/stream_video/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Fixed an issue where toggling camera enabled quickly could cause AVCaptureMultiCamSession to crash.
99
* Fixed an issue where the default camera selection would occasionally be incorrect even when properly configured.
1010
* Fixed an issue where changing the audio input device while muted from the start of a call would not apply the new device when unmuting. The selected device will now be correctly set upon unmuting.
11+
* Fixes an issue with `muteUsers` method when called for all tracks.
1112

1213
## 0.10.0
1314

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2355,10 +2355,13 @@ class Call {
23552355
/// Allows for the muting of all users on a call including the current user
23562356
/// calling the function.
23572357
///
2358+
/// By default the function will mute all the tracks (audio and video) of the users but this
2359+
/// can be override by passing a [track] to the function.
2360+
///
23582361
/// Note: The user calling this function must have permission to perform the
23592362
/// action else it will result in an error.
2360-
Future<Result<None>> muteAllUsers() {
2361-
return _permissionsManager.muteAllUsers();
2363+
Future<Result<None>> muteAllUsers({TrackType track = TrackType.all}) {
2364+
return _permissionsManager.muteAllUsers(track: track);
23622365
}
23632366

23642367
Future<Result<None>> setCameraPosition(CameraPosition cameraPosition) async {

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,15 @@ class PermissionsManager {
307307

308308
final usersToMute = <String>[];
309309
for (final participant in stateManager.callState.otherParticipants) {
310-
if (participant.publishedTracks.containsKey(track.toSFUTrackType())) {
310+
if ((track == TrackType.all && participant.publishedTracks.isNotEmpty) ||
311+
participant.publishedTracks.containsKey(track.toSFUTrackType())) {
311312
usersToMute.add(participant.userId);
312313
}
313314
}
314315
return muteUsers(userIds: usersToMute, track: track);
315316
}
316317

317-
Future<Result<None>> muteAllUsers() async {
318+
Future<Result<None>> muteAllUsers({TrackType track = TrackType.all}) async {
318319
if (!hasPermission(CallPermission.muteUsers)) {
319320
_logger.w(() => '[muteAllUsers] rejected (no permission)');
320321
return Result.error('Cannot mute users (no permission)');
@@ -325,9 +326,9 @@ class PermissionsManager {
325326
callCid: callCid,
326327
muteAllUsers: true,
327328
userIds: const [],
328-
audio: true,
329-
video: true,
330-
screenshare: true,
329+
audio: track == TrackType.audio || track == TrackType.all,
330+
video: track == TrackType.video || track == TrackType.all,
331+
screenshare: track == TrackType.screenshare || track == TrackType.all,
331332
);
332333
}
333334

0 commit comments

Comments
 (0)