Skip to main content

Introduction - Local User

The local user in the dyteMobileClient object has a set of methods and properties related to media controls. These can be accessed using the identifier localUser.

Properties

Here is a list of properties that local user provides:

  • id: ID of the participant pertaining to local user. (aka peerId)
  • userId: The userId of the participant.
  • name: Contains Name of the local user.
  • picture: Link to the url of the participant
  • clientSpecificId: Identifier provided by the developer while adding the participant.
  • flags: Type ParticipantFlags and it contains two boolean values
    • recorder: if the participant is recorder
    • hidden: if the participant is hidden
  • audioEnabled: Boolean value indicating if the audio currently enabled.
  • videoEnabled: Boolean value indicating if the video currently enabled.

Local user properties can be fetched via localUser getter on the dyteClient.

final selfUser = dyteClient.localUser;

Change default audio / video settings

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

final meetingInfo = DyteMeetingInfoV2(
roomName = MEETING_ROOM_NAME,
authToken = AUTH_TOKEN,
audioEnabled = false,
videoEnabled = true
);

Turn on audio/video tracks after initializing the client

If audio and video tracks are disabled during the DyteMobileClient initialization process. You can setup the audio and video tracks by simply calling enableAudio() and enableVideo() like below:

dyteClient.localUser.enableAudio();
dyteClient.localUser.enableVideo();

Change the name of the local user

Change the user's name by calling setDisplayName method. The changed name will reflect across all participants ONLY if the change happens before joining the meeting. This is only possible when the user has the permission to change the name.

if(dyteClient.permissions.miscellaneous.canEditDisplayName)
{
dyteClient.localUser.setDisplayName("New Name");
}

Mute/Unmute microphone

// Mute Audio
dyteClient.localUser.disableAudio();

// Unmute Audio
dyteClient.localUser.enableAudio();

// Get current status
final isAudioEnabled = dyteClient.localUser.audioEnabled;

Enable/Disable camera

// Disable Video
dyteClient.localUser.disableVideo();

// Enable Video
dyteClient.localUser.enableVideo();

// Get current status
final isVideoEnabled = dyteClient.localUser.videoEnabled;

Switch camera between sources

// switch camera
dyteClient.localUser.switchCamera();

Enable / Disable Screen share

Note

Android

To use screenshare on Android devices running Android API 14 and above, you will need to declare the following permission in your app's AndroidManifest.xml.

<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

Adding above permission will require you to do extra steps on Google Play Console while submitting the app. For more information please refer this.

iOS

Refer to screenshare setup for iOS here

// Enable Screenshare
dyteClient.localUser.enableScreenshare();

// Disable Screenshare
dyteClient.localUser.disableScreenshare();