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.moderation.ban({
  target_user_id: '<bad user id>',
  banned_by_id: '<moderator id>',
  reason: '<reason>',
});

// remove the ban for a user
client.moderation.unban({
  target_user_id: '<user id>',
});

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

// ban a user and all users sharing the same IP
client.moderation.ban({
  target_user_id: '<bad user id>',
  banned_by_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>'],
});

// deactivating users in bulk is performed asynchronously
const deactivateResponse = client.deactivateUsers({
  user_ids: ['<id1>', '<id2>'...],
});

Deactivating users in bulk can take some time, this is how you can check the progress:

// Example of monitoring the status of an async task
// The logic is same for all async tasks
const response = await client.<async operation>();

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

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

For more information, please refer to the async operations guide

User blocking

Users can block other users using the API, when a user blocks another it will no longer receive ringing calls or notification from the blocked user.

client.blockUsers({
  blocked_user_id: 'bob',
  user_id: 'alice',
});

client.getBlockedUsers({ user_id: 'alice' });

client.unblockUsers({
  blocked_user_id: 'bob',
  user_id: 'alice',
});
© Getstream.io, Inc. All Rights Reserved.