Skip to main content

Introduction - Local User

The local user in the meeting 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 local user participant.
  • name: Name of the local user.
  • picture: Picture URL of the local user.
  • clientSpecificId: Unique participant ID.
  • permissions: Permissions related to various capabilities within a meeting context for the local user.
  • videoTrack: Video track associated with the local user.
  • screenShareTrack: Video track used for screen sharing by the local user.
  • audioEnabled: A boolean value that shows whether the audio is currently enabled for the local user.
  • videoEnabled: A boolean value that shows whether the video is currently enabled for the local user.
  • screenshareEnabled: A boolean value that shows whether the screenshare is currently enabled for the local user.
  • presetName: A strign value representing name of preset for local user. You can find this preset on Dyte Developer Portal
  • roomJoined: A boolean value representing if local user has joined the room or not.
  • isCameraPermissionGranted: A boolean value representing if local user has access to device Camera permission.
  • isMicrophonePermissionGranted: A boolean value representing if local user has access to device Microphone permission.
  • waitListStatus: Waitlist Status of the local user. It can have four values. None, Waiting, Accepted & Rejected.

Change default audio/video settings

When local user joins the meeting, the SDK will automatically enable local user's video and audio streams. If you want to change this behavior, use the audioEnabled and videoEnabled parameters while configuring the meeting.

val meetingInfo = DyteMeetingInfoV2(
authToken = AUTH_TOKEN,
audioEnabled = false,
videoEnabled = true
)

Get local user video view

To display the localUser preview in a view, utilize the getSelfPreview() method on localUser. This method provides a View that can be added to any ViewGroup in Android.

meeting.localUser.getSelfPreview()

Update the local user's name

You can change the user's name by using the setDisplayName method. However, the name change will be visible to all participants only if it occurs before joinRoom() the meeting and after the init() process.

meeting.localUser.setDisplayName("New Name")

Mute/unmute microphone

Mute/unmute your microphone in the meeting using disableAudio() and enableAudio() methods, and check the current status with audioEnabled.

// Get current status
meeting.localUser.audioEnabled

// Mute Audio
meeting.localUser.disableAudio()

// Unmute Audio
meeting.localUser.enableAudio()

Enable/disable camera

Enable/disable your camera in the meeting using disableVideo() and enableVideo() methods, and check the current status with videoEnabled.

// Get current status
meeting.localUser.videoEnabled

// Disable Video
meeting.localUser.disableVideo()

// Enable Video
meeting.localUser.enableVideo()

Enable / Disable Screen share

Note

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.

// Get current status
meeting.localUser.screenshareEnabled

// Enable Screenshare
meeting.localUser.enableScreenshare()

// Disable Screenshare
meeting.localUser.disableScreenshare()

Switch camera between available camera devices

// get all available video devices
val devices = meeting.localUser.getVideoDevices()

// switch video device
meeting.localUser.setVideoDevice(videoDevice)

// on devices with only 2 camera's you can use
meeting.localUser.switchCamera()

Switch between available audio devices for audio input/output

// get all available audio devices
val devices = meeting.localUser.getAudioDevice()

// switch video device
meeting.localUser.setAudioDevice(audioDevice)