LiveKit JS Client SDK - v2.10.0

    Class LocalParticipant

    Hierarchy (View Summary, Expand)

    Index

    Properties

    audioLevel: number = 0

    audio level between 0-1.0, 1 being loudest, 0 being softest

    audioTrackPublications: Map<string, LocalTrackPublication>
    identity: string

    client assigned identity, encoded in JWT token

    isSpeaking: boolean = false

    if participant is currently speaking

    lastSpokeAt?: Date
    metadata?: string

    client metadata, opaque to livekit

    name?: string

    client assigned display name, encoded in JWT token

    permissions?: ParticipantPermission
    sid: string

    server assigned unique id

    trackPublications: Map<string, LocalTrackPublication>

    map of track sid => all published tracks

    videoTrackPublications: Map<string, LocalTrackPublication>

    Accessors

    • get attributes(): Readonly<Record<string, string>>

      participant attributes, similar to metadata, but as a key/value map

      Returns Readonly<Record<string, string>>

    Methods

    • Parameters

      Returns Promise<
          {
              attachedFiles?: File[];
              editTimestamp: number;
              id: string;
              message: string;
              timestamp: number;
          },
      >

    • Publish both camera and microphone at the same time. This is useful for displaying a single Permission Dialog box to the end user.

      Returns Promise<void>

    • Publish a new data payload to the room. Data will be forwarded to each participant in the room if the destination field in publishOptions is empty

      Parameters

      • data: Uint8Array

        Uint8Array of the payload. To send string data, use TextEncoder.encode

      • options: DataPublishOptions = {}

        optionally specify a reliable, topic and destination

      Returns Promise<void>

    • Publish SIP DTMF message to the room.

      Parameters

      • code: number

        DTMF code

      • digit: string

        DTMF digit

      Returns Promise<void>

    • Parameters

      • file: File
      • Optionaloptions: {
            destinationIdentities?: string[];
            mimeType?: string;
            onProgress?: (progress: number) => void;
            topic?: string;
        }

      Returns Promise<{ id: string }>

    • Set or update participant attributes. It will make updates only to keys that are present in attributes, and will not override others. Note: this requires canUpdateOwnMetadata permission.

      Parameters

      • attributes: Record<string, string>

        attributes to update

      Returns Promise<void>

    • Sets and updates the metadata of the local participant. Note: this requires canUpdateOwnMetadata permission. method will throw if the user doesn't have the required permissions

      Parameters

      • metadata: string

      Returns Promise<void>

    • Sets and updates the name of the local participant. Note: this requires canUpdateOwnMetadata permission. method will throw if the user doesn't have the required permissions

      Parameters

      • name: string

      Returns Promise<void>

    • Control who can subscribe to LocalParticipant's published tracks.

      By default, all participants can subscribe. This allows fine-grained control over who is able to subscribe at a participant and track level.

      Note: if access is given at a track-level (i.e. both [allParticipantsAllowed] and [ParticipantTrackPermission.allTracksAllowed] are false), any newer published tracks will not grant permissions to any participants and will require a subsequent permissions update to allow subscription.

      Parameters

      • allParticipantsAllowed: boolean

        Allows all participants to subscribe all tracks. Takes precedence over [[participantTrackPermissions]] if set to true. By default this is set to true.

      • participantTrackPermissions: ParticipantTrackPermission[] = []

        Full list of individual permissions per participant/track. Any omitted participants will not receive any permissions.

      Returns void

    MMNEPVFCICPMFPCPTTAAATR