Skip to main content

Introduction - Local User

The local user in a meeting is represented by RtkSelfParticipant and can be accessed as meeting.localUser. It has a set of methods and properties related to local user's state and media controls.

Properties

Here is a list of properties that local user provides:

  • id: ID of the local user participant. (aka peerId)
  • userId: The userId of the participant.
  • name: Name of the local user.
  • picture: URL to the picture of the local user (optional).
  • isHost: A boolean value indicating whether the local user is a host.
  • isPinned: A boolean value indicating whether the local user is pinned.
  • isMicrophonePermissionGranted: A boolean value indicating whether the microphone permission is granted for the local user.
  • isCameraPermissionGranted: A boolean value indicating whether the camera permission is granted for the local user.
  • customParticipantId: User provided participant ID (optional).
  • audioEnabled: A boolean value indicating whether the audio is currently enabled for the local user.
  • videoEnabled: A boolean value indicating whether the video is currently enabled for the local user.
  • screenShareEnabled: A boolean value indicating whether the screen share is currently enabled for the local user.
  • stageStatus: Value indicating the stage status of the local user of type StageStatus.
  • flags: Type ParticipantFlags and it contains two boolean values
    • recorder: if the participant is recorder
    • hidden: if the participant is hidden

Change default audio / video settings

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

final meetingInfo = RtkMeetingInfo(
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 RealtimeKitClient initialization process. You can setup the audio and video tracks by simply calling enableAudio() and enableVideo() like below:

meeting.localUser.enableAudio(onResult: (e) {
// handle error if any
});

meeting.localUser.enableVideo(onResult: (e) {
// handle error if any
});

Change the name of the local user

You can change the user's name by using the setDisplayName method. However, the name change will reflect across all participants ONLY if it occurs before joinRoom() and after the init() process. This is only possible when the local user has the preset permission to change the name.

if (meeting.permissions.miscellaneous.canEditDisplayName) {
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
final isAudioEnabled = meeting.localUser.audioEnabled;

// Mute Audio
meeting.localUser.disableAudio(onResult: (e) {
// handle error if any
});

// Unmute Audio
meeting.localUser.enableAudio(onResult: (e) {
// handle error if any
});

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
final isVideoEnabled = meeting.localUser.videoEnabled;

// Mute Video
meeting.localUser.disableVideo(onResult: (e) {
// handle error if any
});

// Unmute Video
meeting.localUser.enableVideo(onResult: (e) {
// handle error if any
});

Switch camera between sources

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

Enable / Disable Screen share

Enable/disable screenshare in the meeting using disableScreenShare() and enableScreenShare() methods.

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 to Google's documentation.

iOS

Refer to screenshare setup for iOS here

// Enable Screenshare
meeting.localUser.enableScreenShare();

// Disable Screenshare
meeting.localUser.disableScreenShare();