Skip to main content

Introduction - Local User

The local user has the methods and properties on the local user media controls. Accessible via self key within the meeting object, the local user also contains the access control (permissions) and theming-related properties that will help to render the meeting state.

Properties

Here is a list of properties that local user provides:

  • id: The ID of the participant pertaining to local user.
  • name: Contains Name of the local user.
  • clientSpecificId: Identifier provided by the developer while adding the participant.
  • roomJoined: A boolean value indicating if the local user has joined the meeting.
  • preview: The local audio and video stream for the preview purpose (it will be populated after calling enablePreview).
  • permissions: The permissions related to various capabilities within a meeting context for the local user
  • mediaPermissions: The current audio and video permissions given by the local user.
  • audioTrack: The audio track for the local user.
  • videoTrack: The video track for the local user.
  • screenShareTracks: The screen share video and audio tracks for the local user.
  • audioEnabled: A boolean value indicating if the audio currently enabled.
  • videoEnabled: A boolean value indicating if the video currently enabled.
  • screenShareEnabled: A boolean value indicating if the screen share is currently enabled.
  • suggestedTheme: The suggested theme for building the user interface.

Change default audio / video settings

By default as soon as you join the meeting the SDK will produce your video and audio streams. To change this behaviour use the default parameter

const meeting = await DyteClient.init({
roomName,
authToken,
defaults: {
audio: false, // Disable user's audio by default
video: true, // Enable user's video by default
},
});

Setup tracks

If audio and video tracks are disabled during the DyteClient initialization process. You can setup the audio and video tracks by simply calling setup tracks method like below:

meeting.self.setupTracks({ audio: true, video: true });

Change the name of the local user

Change the user's name by calling setName method. The changed name will reflect across all participants ONLY if the change happens before joining the meeting.

await meeting.self.setName('New Name');

Mute/Unmute microphone

// Mute Audio
await meeting.self.disableAudio();

// Unmute Audio
await meeting.self.enableAudio();

// Get current status
meeting.self.audioEnabled;

Enable/Disable camera

// Disable Video
await meeting.self.disableVideo();

// Enable Video
await meeting.self.enableVideo();

// Get current status
meeting.self.videoEnabled;

Enable / Disable Screen share

// Enable Screenshare
await meeting.self.enableScreenShare();

// Disable Screenshare
await meeting.self.disableScreenShare();

// Get current status
meeting.self.screenShareEnabled;

Preview media

Preview methods can be used to test the video / audio stream before sharing them with the meeting.

Enable / Disable Audio and Video Preview

Enable a preview for audio and video. This will populate the preview property for the local user. You can check if the streams are enabled in the preview using meeting.self.preview.audioEnabled and meeting.self.preview.videoEnabled.

// Enable preview
await meeting.self.enablePreview();

// Disable preview
await meeting.self.disablePreview();

// Enable only audio preview
await meeting.self.enablePreview({ video: false });

// Enable only video preview
await meeting.self.enablePreview({ audio: false });