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.
let meetingInfo = RtkMeetingInfo(
authToken = AUTH_TOKEN,
audioEnabled = false,
videoEnabled = true
)
Get local user video view
To show localUser preview inside a view. Use getSelfPreview()
method on
localUser. This method returns a View which can be added in any View.
meeting.localUser.getSelfPreview()
Turn audio/video tracks after joining the room
If audio and video tracks are disabled during the RealtimeKitClient
initialization process. You can setup the audio and video tracks by simply
calling enableAudio()
and enableVideo()
like below:
meeting.localUser.enableAudio { err: AudioError? in
}
meeting.localUser.enableVideo { err: VideoError? in
}
Change the name of the local user
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 calling joinRoom()
, and after the init()
process.
meeting.localUser.setDisplayName("New Name")
Mute/Unmute microphone
// Mute Audio
meeting.localUser.disableAudio { err: AudioError? in }
// Unmute Audio
meeting.localUser.enableAudio { err: AudioError? in }
// Get current status
meeting.localUser.audioEnabled
Enable/Disable camera
// Disable Video
meeting.localUser.disableVideo { err: VideoError? in }
// Enable Video
meeting.localUser.enableVideo { err: VideoError? in }
// Get current status
meeting.localUser.videoEnabled
Pinning & unpinning
You can pin or unpin yourself given you have the appropriate permissions. You
can check the pinned status of the local user using meeting.localUser.isPinned
.
meeting.localUser.pin();
meeting.localUser.unpin();
Enable / Disable Screen share
// Enable Screenshare
let err: ScreenShareError? = meeting.localUser.enableScreenshare();
// Disable Screenshare
let err: ScreenShareError? = meeting.localUser.disableScreenshare();
Switch camera between primary and secondary
// switch camera
meeting.localUser.switchCamera()
OR
If you want to set video device yourself:
meeting.localUser.setVideoDevice(videoDevice: VideoDevice)