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 PortalroomJoined
: 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.
- Kotlin
- Java
val meetingInfo = DyteMeetingInfoV2(
authToken = AUTH_TOKEN,
audioEnabled = false,
videoEnabled = true
)
DyteMeetingInfoV2 meetingInfo = DyteMeetingInfoV2(
AUTH_TOKEN,
false,
true,
"dyte.io"
);
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.
- Kotlin
- Java
meeting.localUser.getSelfPreview()
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.
- Kotlin
- Java
meeting.localUser.setDisplayName("New Name")
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
.
- Kotlin
- Java
// Get current status
meeting.localUser.audioEnabled
// Mute Audio
meeting.localUser.disableAudio()
// Unmute Audio
meeting.localUser.enableAudio()
// 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
.
- Kotlin
- Java
// Get current status
meeting.localUser.videoEnabled
// Disable Video
meeting.localUser.disableVideo()
// Enable Video
meeting.localUser.enableVideo()
// Get current status
meeting.localUser.videoEnabled;
// Disable Video
meeting.localUser.disableVideo();
// Enable Video
meeting.localUser.enableVideo();
Enable / Disable Screen share
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.
- Kotlin
- Java
// Get current status
meeting.localUser.screenshareEnabled
// Enable Screenshare
meeting.localUser.enableScreenshare()
// Disable Screenshare
meeting.localUser.disableScreenshare()
// Get current status
meeting.localUser.screenshareEnabled;
// Enable Screenshare
meeting.localUser.enableScreenshare();
// Disable Screenshare
meeting.localUser.disableScreenshare();
Switch camera between available camera devices
- Kotlin
- Java
// 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()
// get all available video devices
List<DyteVideoDevice> devices = meeting.localUser.getVideoDevices();
// switch video device
meeting.localUser.setVideoDevice(videoDevice);
Switch between available audio devices for audio input/output
- Kotlin
- Java
// get all available audio devices
val devices = meeting.localUser.getAudioDevice()
// switch video device
meeting.localUser.setAudioDevice(audioDevice)
// get all available video devices
List<DyteAudioDevice> devices = meeting.localUser.getAudioDevices();
// switch video device
meeting.localUser.setAudioDevice(audioDevice);