Client Methods
async join()
Join()
is the first method to be invoked to join the room.
All other HuddleClient functions are only available after the join()
method is invoked.
Return Type :
Promise<Void>
Params
Param | Type | Required |
---|---|---|
roomId | string | required |
walletData | TWalletData | required |
TWalletData
type TWalletData = {
address: string;
wallet: string; // metamask, walletConnect etc.
ens: string;
};
address
Wallet Address of the user joinedwallet
Type of Wallet Used.ens
ENS name used.
NOTE:
roomID
is the unique identifier of the room to be joined, while joining more than one peer to the room make sure to use the same roomID.One is expected to use the same roomID for all the peers meant to be joining the same room.
Code Snippet
await huddleClient.join("rDVjHUcf4X", // roomId
{
address: "0x15900c698ee356E6976e5645394F027F0704c8Eb", //walletAddress
ens: "axit.eth", //ens name
});
async enableWebcam()
enableWebcam()
to enable the webcam of the user.
Return Type :
Promise<Void>
Code Snippet:
huddleClient.enableWebcam();
async disableWebcam()
disableWebcam()
to disable the webcam of the user.
Return Type :
Promise<Void>
Code Snippet:
huddleClient.disableWebcam();
getWebcams()
getWebcams()
to get the list of available webcams.
Return Type :
MediaDeviceInfo[]
Code Snippet:
const webcamList = huddleClient.getWebcams();
async changeWebcam()
changeWebcam()
to switch the webcam of the user.
To fetch the list of available webcams use getWebcams()
which returns MediaDeviceInfo[]
.
Return Type :
Promise<Void>
Params:
Param | Type | Required |
---|---|---|
mediaDevice | MediaDeviceInfo | optional |
Code Snippet:
const webcamList = huddleClient.getWebcams();
await huddleClient.changeWebcam(webcamList[0]);
async enableMic()
enableMic()
to enable the microphone of the user.
Return Type :
Promise<Void>
Code Snippet:
huddleClient.enableMic();
async disableMic()
disableMic()
to disable the microphone of the user.
Note : This will stop the audio stream from the user's microphone and mute the user. Using
muteMic()
is preferred overdisableMic()
as it will not stop the audio stream from the user's microphone.muteMic()
is generally faster and more efficient thandisableMic()
as the latter stops the audio stream from the user's microphone.
Return Type :
Promise<Void>
Code Snippet:
huddleClient.disableMic();
getMics()
getMics()
to get the list of available microphones.
Return Type :
MediaDeviceInfo[]
Code Snippet:
const micList = huddleClient.getMics();
async changeMic()
changeMic()
to switch the microphone of the user.
To fetch the list of available microphones use getMics()
which returns MediaDeviceInfo[]
.
Params:
Param | Type | Required |
---|---|---|
mediaDevice | MediaDeviceInfo | optional |
Code Snippet
const micList = huddleClient.getMics();
await huddleClient.changeMic(micList[0]);
async muteMic()
muteMic()
to mute the microphone of the user.
Note : This will stop the audio stream from the user's microphone and mute the user. Using
muteMic()
is preffered overdisableMic()
as it will not stop the audio stream from the user's microphone.muteMic()
is generally faster and more efficient thandisableMic()
as the latter stops the audio stream from the user's microphone. UsemuteMic()
andunmuteMic()
when you want a quick mute/unmute functionality.
Return Type :
Promise<Void>
Code Snippet:
await huddleClient.muteMic();
changeAvatarUrl()
changeAvatarUrl()
to change the avatar image URL of the user.
NOTE : The avatar image URL should be a valid URL and should be accessible on the internet.
Supported Image Formats : PNG, JPG, JPEG, SVG
Params:
Param | Type | Required |
---|---|---|
avatarUrl | string url | required |
Code Snippet:
huddleClient.changeAvatarUrl(
"https://openseauserdata.com/files/688ce238dd835db6fd8744b4a0f13eb8.svg"
);
async sendDM()
sendDM()
to send a direct message to a peer in the same room.
Params:
Param | Type | Required |
---|---|---|
message | string | required |
toId | string | required |
fromId | string | required |
Return Type :
Promise<Void>
Code Snippet:
await huddleClient.sendDM("Hi! Welcome to Huddle01!", // message string
"rDVjHUcf4X", // recipient's peerId / toId
"zlQpt69c69" // sender's peerId / fromId
);
async toggleRaiseHand()
Params:
Param | Type | Required |
---|---|---|
isHandRaised | boolean | required |
Code Snippet:
huddleClient.toggleRaiseHand(
isHandRaised: true
);
async sendReaction()
Params:
Param | Type | Required |
---|---|---|
reaction | '', '😂', '😢', '😦', '😍', '🤔', '👀', '🙌', '👍', '👎', '🔥', '🍻', '🚀', '🎉', '❤️', '💯' | required |
Code Snippet:
huddleClient.sendReaction("🚀");
async allowLobbyPeerToJoinRoom()
allowLobbyPeerToJoinRoom()
allows a peer in the lobby to join the room using the respective peerId
.
Params:
Param | Type | Required |
---|---|---|
peerId | string | required |
Code Snippet:
huddleClient.allowLobbyPeerToJoinRoom("rDVjHUcf4X"); // allow peer in lobby with peerId "rDVjHUcf4X" to join the room
async allowAllLobbyPeersToJoinRoom()
allowAllLobbyPeersToJoinRoom()
to allow all peers in the lobby to join the room.
Code Snippet:
huddleClient.allowAllLobbyPeersToJoinRoom(); // allow all lobby peers in room
async disallowLobbyPeerFromJoiningRoom()
disallowLobbyPeerFromJoiningRoom()
to disallow a peer in the lobby from joining the room using respective peerId
.
Params:
Param | Type | Required |
---|---|---|
peerId | string | required |
Code Snippet
huddleClient.disallowLobbyPeerFromJoiningRoom("rDVjHUcf4X"); // disallow peer in lobby with peerId "rDVjHUcf4X" from joining the room
disallowAllLobbyPeerFromJoiningRoom()
disallowAllLobbyPeerFromJoiningRoom()
to disallow all peers in the lobby from joining the room.
Code Snippet:
huddleClient.disallowAllLobbyPeerFromJoiningRoom();
async startRecording()
We have abstracted out the recording process needed into our own micro service, as its our own service you cannot use the feature on localhost.
When you invoke this function we initate our service which spins up a bot to go to your link and record that website. After you stop the recording you can find the link inside the recording store states.
Check out Recording States
Param | Type | Required |
---|---|---|
address | string | optional |
sourceUrl | string | required |
Code Snippet:
huddleClient.startRecording({
'0xHc6BW8hhYKpz6VUWEcp4dCi',
"https://www.youtube.com/watch?v=fmNeDQxJBOU"
});
NOTE: This will send request to our recording service to start a bot and send the bot to record the given youtube video. The wallet address sent will allow the person with this address to access the recording from Huddle01 Dashboard
async stopRecording()
Invoking this function stops the recording, if you allow to upload the recording to IPFS we will handle all that for you. You can find the recording on Huddle01 Dashboard
Check out Recording States
Param | Type | Required |
---|---|---|
ipfs | boolean | required |
Code Snippet:
huddleClient.stopRecording({
ipfs: true
});
NOTE: The wallet address sent when starting the recording will allow the person with this address to access the recording from Huddle01 Dashboard
async startLiveStreaming()
The ability to livestream a particular meeting is abstracted in the SDK, We can be livestream on Youtube
, Livepeer
& Twitch
. Right now you cannot mutistream
Check out Recording States
Param | Type | Required |
---|---|---|
platform | yotube , livepeer , twitch | required |
streamObj | TLiveStreamObject | optional |
sourceUrl | string | optional |
type TLiveStreamObject = {
streamLink: string;
streamKey: string;
streamName: string;
};
Code Snippet:
huddleClient.startLiveStreaming({
platform: 'youtube',
streamObj: {
streamLink: '...',
streamKey: '...',
streamName: '...'
}
});
async stopLiveStreaming()
Invoking this function stops the livestreaming, upon doing this the livestreaming states are toggled and using this you can configure your logic
Checkout Livestreaming States
Param | Type | Required |
---|---|---|
platform | yotube , livepeer , twitch | required |
type TLiveStreamObject = {
streamLink: string;
streamKey: string;
streamName: string;
};
Code Snippet:
huddleClient.startLiveStreaming({
platform: 'youtube',
streamObj: {
streamLink: '...',
streamKey: '...',
streamName: '...'
}
});
💡 For any help reach out to us on Discord