Skip to main content

Permissions & Moderation

Permissions for a video call can be quite complicated. Use cases like educational apps, live events, audio rooms and livestreams require detailed permissions.

Requesting & Granting permission

This example shows how to check if you have permissions to do something and ask for permission. Let's say that you've joined an audio room and want to speak

// see if you currently have this permission
var canSendAudio = streamCall.HasPermissions(OwnCapability.SendAudio);

// request the host to grant you this permission
val response = call.requestPermissions("send-audio")

You grant permissions directly using GrantPermissionsAsync method on an instance of IStreamCall like the example below:

// Grant permission to user with specific user ID
await streamCall.GrantPermissionsAsync(new[] { OwnCapability.SendAudio }, "user-id");

// Grant permission to user using instance of IStreamVideoUser
await streamCall.GrantPermissionsAsync(new[] { OwnCapability.SendAudio }, user);

// Grant permission to call participant using instance of IStreamVideoCallParticipant
await streamCall.GrantPermissionsAsync(new[] { OwnCapability.SendAudio }, participant);

You can request the following 3 permissions: OwnCapability.SendAudio, OwnCapability.SendVideo, and OwnCapability.Screenshare.

Moderation Capabilities

Blocking users on a call

// Block user in a call using user ID
await streamCall.BlockUserAsync("user-id");

// Block user in a call using their instance of IStreamVideoUser
await streamCall.BlockUserAsync(user);

// Block user in a call using their instance of IStreamVideoCallParticipant
await streamCall.BlockUserAsync(participant);

Removing users from a call

// Remove user from a call using their user ID
await streamCall.RemoveMembersAsync(new[] { "user-id" });

// Remove user from a call using their instance of IStreamVideoUser
await streamCall.RemoveMembersAsync(new[] { user });

// Remove user from a call using their instance of IStreamVideoCallParticipant
await streamCall.RemoveMembersAsync(new[] { participant });

Mute users in a call

// Mute user in a call using their user ID and choose which of their tracks you want to mute: audio, video, or screenShare
await streamCall.MuteUsersAsync(new[] { "user-id" }, audio: true, video: true, screenShare: true);

// Mute user in a call using their instance of IStreamVideoUser and choose which of their tracks you want to mute: audio, video, or screenShare
await streamCall.MuteUsersAsync(new[] { user }, audio: true, video: true, screenShare: true);

// Mute user in a call using their instance of IStreamVideoCallParticipant and choose which of their tracks you want to mute: audio, video, or screenShare
await streamCall.MuteUsersAsync(new[] { participant }, audio: true, video: true, screenShare: true);

Mute all users

// Mute all user in a call and choose which of their tracks you want to mute: audio, video, or screenShare
await streamCall.MuteAllUsersAsync(audio: true, video: true, screenShare: true);

Did you find this page helpful?