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
: URL to the picture of the local user (optional).customParticipantId
: User provided participant ID (optional).permissions
: Permissions related to various capabilities within a meeting context for 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 string value representing name of preset for local user. You can find this preset on RealtimeKit Developer PortalpresetInfo
: A typed object representing the preset information for local user.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 the local user joins the meeting, the SDK will automatically enable the video and audio streams. If you want to change this behavior, use the audioEnabled
and videoEnabled
parameters while configuring the meeting.
val meetingInfo = RtkMeetingInfo(
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 { error: AudioError? -> }
// Unmute Audio
meeting.localUser.enableAudio { error: AudioError? -> }
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 { error: VideoError? -> }
// Enable Video
meeting.localUser.enableVideo { error: VideoError? -> }
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 to Google's documentation.
// 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(devices[0])
// on devices with only 2 cameras you can use
meeting.localUser.switchCamera()
Switch between available audio devices for audio input/output
// get all available audio devices
val devices = meeting.localUser.getAudioDevices()
// switch video device
meeting.localUser.setAudioDevice(devices[0])