Represents a peer in the HMS ecosystem.

This class encapsulates the properties and state of a peer within a session, including their ID, name, role, and various status flags.

Export

Hierarchy

Constructors

Properties

peerID: string

The unique identifier for the peer.

Accessors

  • get audioTrack(): undefined | HMSAudioTrack
  • Retrieves the audio track associated with the peer.

    This getter method attempts to obtain the audio track of the peer. It first tries to get this information from the HMS peers cache. If the audio track information is not available in the cache, it falls back to fetching the audio track directly from the native layer using the peer's ID. This allows for real-time access to the peer's audio track, which can be used for various audio-related functionalities within the application.

    Returns undefined | HMSAudioTrack

    The audio track of the peer if available, otherwise undefined.

  • get auxiliaryTracks(): undefined | HMSTrack[]
  • Retrieves the auxiliary tracks associated with the peer.

    This getter method attempts to obtain the auxiliary tracks of the peer, which can include tracks like screen shares or additional media streams. It first tries to get this information from the HMS peers cache. If the auxiliary track information is not available in the cache, it falls back to fetching the auxiliary tracks directly from the native layer using the peer's ID. This allows for real-time access to the peer's auxiliary tracks, which can be used for various functionalities within the application, such as displaying a screen share or additional video feeds.

    Returns undefined | HMSTrack[]

    The auxiliary tracks of the peer if available, otherwise undefined.

  • get customerUserID(): undefined | string
  • Retrieves the custom user ID of the peer.

    This getter method attempts to obtain the custom user ID of the peer, which is an optional identifier that can be set by the application. It first tries to get this information from the HMS peers cache. If the information is not available in the cache, it falls back to fetching the custom user ID directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local _customerUserID property to ensure the value is current and consistent.

    Returns undefined | string

    The custom user ID of the peer if available, otherwise undefined.

  • get isHandRaised(): boolean
  • Checks if the peer has raised their hand.

    This getter method determines whether the peer has their hand raised in the session. It first attempts to retrieve the 'isHandRaised' property value from the HMS peers cache. If the value is not found in the cache, it falls back to fetching the property directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local _isHandRaised property to ensure the value is current and consistent.

    Returns boolean

    True if the peer has their hand raised, false otherwise. Defaults to false if the information is not available.

  • get isLocal(): undefined | boolean
  • Determines if the peer is the local user.

    This getter method checks if the peer is the local user by first attempting to retrieve the 'isLocal' property value from the HMS peers cache. If the value is not found in the cache, it falls back to fetching the property directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local _isLocal property to ensure the value is current.

    Returns undefined | boolean

    True if the peer is the local user, false otherwise. Returns undefined if the information is not available.

  • get metadata(): undefined | string
  • Retrieves the metadata associated with the peer.

    This getter method attempts to obtain the metadata of the peer, which can include any additional information set by the application. It first tries to get this information from the HMS peers cache. If the information is not available in the cache, it falls back to fetching the metadata directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local _metadata property to ensure the value is current and consistent.

    Returns undefined | string

    The metadata of the peer if available, otherwise undefined.

  • get name(): undefined | string
  • Gets the name of the peer.

    This getter method retrieves the name of the peer. If the name has already been set locally, it returns that value. Otherwise, it attempts to retrieve the name from the HMS peers cache. If the cache does not contain the name, it falls back to fetching the name directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local _name property to ensure consistency.

    Returns undefined | string

    The name of the peer if available, otherwise undefined.

  • get networkQuality(): undefined | HMSNetworkQuality
  • Retrieves the network quality of the peer.

    This getter method attempts to obtain the network quality of the peer, which is an indicator of the current network conditions affecting the peer's connection. It first tries to get this information from the HMS peers cache. If the information is not available in the cache, it falls back to fetching the network quality directly from the native layer using the peer's ID. The network quality is represented by the HMSNetworkQuality type, which may include values such as 'good', 'poor', etc., depending on the implementation.

    Returns undefined | HMSNetworkQuality

    The network quality of the peer if available, otherwise undefined.

  • get role(): undefined | HMSRole
  • Retrieves the role of the peer.

    This getter method attempts to obtain the role assigned to the peer within the session. The role can define permissions and capabilities within the session context. It first tries to get this information from the HMS peers cache. If the role information is not available in the cache, it falls back to fetching the role directly from the native layer using the peer's ID. Once a value is retrieved, it updates the local _role property to ensure the value is current and consistent.

    Returns undefined | HMSRole

    The role of the peer if available, otherwise undefined.

  • get type(): HMSPeerType
  • Retrieves the type of the peer.

    This getter method attempts to obtain the type of the peer, which can indicate whether the peer is a regular participant, a screen share, or another type defined within the HMSPeerType enum. It first tries to get this information from the HMS peers cache. If the type information is not available in the cache, it falls back to fetching the type directly from the native layer using the peer's ID. This ensures that the application has real-time access to the peer's type, which can be crucial for handling different peer types differently, such as displaying a screen share in a distinct manner. Once a value is retrieved, it updates the local _type property to ensure the value is current.

    Returns HMSPeerType

    The type of the peer, defaulting to the value stored in _type if the information is not available.

Generated using TypeDoc