Skip to main content

Overview

When running calls with a larger audience, you’ll often need moderation features to prevent abuse. Participants can share inappropriate content via

  • The video feed
  • Audio
  • Screen share
  • Chat messages
  • Username

Stream has tools to help you manage these issues while on a call.

Removing & Blocking a member from a call

Call can be configured to only be accessible to their members. To remove a user from a call and prevent from accessing again:

// Block user
call.blockUser({ user_id: 'sara' });

// Unblock user
call.unblockUser({ user_id: 'sara' });

Call permissions

You can configure if a screen share is enabled, disabled or requires requesting permission

call.update({
settings_override: {
screensharing: { enabled: true, access_request_enabled: true },
},
});

Muting everyone

You can also mute every other participant’s video or audio.

// You can specify which kind of stream(s) to mute
call.muteUsers({
mute_all_users: true,
audio: true,
muted_by_id: 'john'
});

Muting one participant's video or audio (or both)

call.muteUsers({
user_ids: ['sara'],
audio: true,
video: true,
screenshare: true,
screenshare_audio: true,
muted_by_id: 'john'
});

Granting and revoking permissions

It's possible for users to ask for any of the following permissions:

  • Sending audio
  • Sending video
  • Sharing their screen

This feature is very common in audio rooms where users usually have to request permission to speak, but it can be useful in other call types and scenarios as well.

These requests will trigger the call.permission_request webhook.

This is how these requests can be accepted:

call.updateUserPermissions({
user_id: 'sara',
grant_permissions: [VideoOwnCapability.SEND_AUDIO],
});

For moderation purposes any user's permission to

  • send audio
  • send video
  • share their screen

can be revoked at any time. This is how it can be done:

call.updateUserPermissions({
user_id: 'sara',
revoke_permissions: [VideoOwnCapability.SEND_AUDIO],
});

Banning users

Users can be banned, when doing that they are not allowed to join or create calls. Banned users also cannot ring or notify other users.

client.banUser({
target_user_id: '<bad user id>',
user_id: '<moderator id>',
reason: '<reason>'
});

// remove the ban for a user
client.unbanUser({
targetUserId: '<user id>'
});

// ban a user for 30 minutes
client.banUser({
target_user_id: '<bad user id>',
user_id: '<moderator id>',
timeout: 30
});

// ban a user and all users sharing the same IP
client.banUser({
target_user_id: '<bad user id>',
user_id: '<moderator id>',
reason: '<reason>',
ip_ban: true
});

Deactivating users

Deactivated users are no longer able to make any API call or connect to websockets (and receive updates on event of any kind).

client.deactivateUser({
user_id: '<id>',
});

//reactivate
client.reactivateUsers({
user_ids: ['<id>'],
});

// deactivativating users in bulk can take some time
const deactivateResponse = client.deactivateUsers({
user_ids: ['<id1>', '<id2>'...],
});

// you need to poll this endpoint
const taskResponse = await client.getTaskStatus({id: deactivateResponse.task_id})

console.log(taskResponse.status === 'completed');

Did you find this page helpful?