Remote Peer

Remote peers are peers who are present in the room. It doesn't include local peer.

Example

// This will have an array of remote peers
const remotePeers = huddleClient.room.remotePeers;

getConsumer

getConsumer gets the associated consumer for the labels.

Parameters

ParamsTypeDescriptionReturn Type
rolevideo | audiogets the associated consumer for the labelsconsumer

Example

// This will get consumer of remote peer
await huddleClient.room.getRemotePeerById('YOUR_PEER_ID').getConsumer('YOUR_LABEL');

getMetadata

getMetadata gets the metadata of the Remote Peer in the Room.

Parameters

DescriptionReturn Type
gets the metadata of the Remote Peer in the Roomvoid

Example

// This will get metadata of remote peer
await await huddleClient.room.getRemotePeerById('YOUR_PEER_ID').getMetadata();

updateRole

updateRole update the role of the Remote Peer in the Room, this will emit an event updated with the updated role.

Parameters

ParamsTypeDescriptionReturn Type
rolestringupdate the role of the Remote Peer in the Roomvoid

Example

// This will update role of remote peer
await huddleClient.room.getRemotePeerById('YOUR_PEER_ID').updateRole({role:string});

updatePermissions

updatePermissions updates the Permissions of the Remote Peer in the Room. This will emit an event updated with the updated permissions.

Parameters

ParamsTypeDescriptionReturn Type
dataTPermissionsupdates the Permissions of the Remote Peer in the RoomPromise<void>

Example

// This will update permissions of remote peer
await huddleClient.room.getRemotePeerById('YOUR_PEER_ID').updatePermissions(data:TPermissions);

Events

Event NameDescriptionReturns
metadata-updatedInvoked when a remote user metadata successfully updates.{ metadata?: string }
role-updatedInvoked when a rempote user's role successfully updates.{ role?: string }
stream-availableInvoked when a remote peer stream is available.{label: string, labelData: { producerId: string }}
stream-closedInvoked when a remote peer stream is closed.{label: string, reason?: {code: number; tag: string; message: string;}}
stream-playableInvoked when a remote peer stream is playable.{label: string, labelData: { consumer: Consumer }}

Example

// get remote peer 
const remotePeer = huddleClient.room.getRemotePeerById('YOUR_PEER_ID');
 
// Event listeners for the Remote Peer
remotePeer.on("metadata-updated", () => {
  console.log("successfully updated remote peer metadata.");
});
 
remotePeer.once("stream-available", (data) => {
  console.log("Remote Peer stream is available.");
});
 
remotePeer.off("stream-closed", () => {
  console.log("Remote Peer Stream is closed.");
});
Audio/Video Infrastructure designed for developers to empower them to ship simple yet powerful Audio/Video Apps.
support
company
Copyright © 2024 Graphene 01, Inc. All Rights Reserved.