@dapp-sdk/messaging-huddle01
Version:
Audio Video Module by Huddle01
172 lines • 5.91 kB
TypeScript
import { AudioSpacesInterface, TRoomControls } from '@dapp-sdk/huddle01-interfaces';
import { IPeer } from '@huddle01/web-core';
/**
* @description Interface for the response of creating a new audio space
*/
export interface ICreateSpacesResponse {
message: string;
data: {
roomId: string;
};
}
/**
* @description Client for audio spaces apps
*
*/
export default class AudioSpacesClient extends AudioSpacesInterface {
/**
* @description Generates a new spaces id
* @param {string} apiKey string
* @param {string[]} hostWallets array of wallet addresses
* @param {string} title title of the meeting
* @returns {Promise<ICreateSpacesResponse>} { message: string, data: { roomId: string } }
* @see https://huddle01.com/docs/api-keys for more information on how to get an api key
*/
static createMeet(apiKey: string, hostWallets: string[], title: string): Promise<ICreateSpacesResponse>;
constructor(projectId: string);
/**
* @description Joins a lobby
* @param spaceId string
*/
joinLobby(spaceId: string): void;
/**
* @description Leaves a lobby
* @requires joinLobby to be called first
*/
leaveLobby(): void;
/**
* @description Join the space from the lobby
* @requires joinLobby to be called first
*/
joinSpace(): void;
/**
* @description Leaves the space
* @requires joinSpace to be called first
*/
leaveSpace(): void;
/**
* @description Ends the space
* @requires joinSpace to be called first
*/
endSpace(): void;
/**
* @description Fetches the local audio stream from the microphone
* @param deviceId optional
* @returns {Promise<MediaStream>}
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
fetchAudioStream(deviceId?: string | undefined): Promise<MediaStream>;
/**
* @description Stops the local audio stream
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
stopAudioStream(): void;
/**
* @description Produces the audio stream, this is required to send audio to other peers
* @param {MediaStream} micStream required
* @param peerIds optional
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
produceAudio(micStream: MediaStream, peerIds?: string[]): void;
/**
* @description Stops producing audio
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
stopProducingAudio(): void;
/**
* @description Enumerates the microphone devices
* @returns {Promise<MediaDeviceInfo[]>}
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
enumerateMicDevices(): Promise<MediaDeviceInfo[]>;
/**
* @description Consume the audio stream from a peer
* @param {string} peerId required
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
createMicConsumer(peerId: string): void;
/**
* @description Stops consuming the audio stream from a peer
* @param {string} peerId required
* @see https://huddle01.com/docs/Javascript/methods/audio for more information
*/
closeMicConsumer(peerId: string): void;
/**
* @description Get peerData by peerId
* @param {string} peerId required
* @returns {IPeer} Peer data object
*/
getPeer(peerId: string): IPeer;
/**
* @description Get all peers
* @returns {IPeer[]} Array of peer data objects
*/
getPeers(): IPeer[];
/**
* @description Get the current user's peerId
* @returns {string} peerId
*/
getMeId(): string;
/**
* @description Get the video and audio tracks of a peer
* @param {string} peerId required
* @returns {MediaStreamTrack[]} Array of tracks
*/
getPeerTracks(peerId: string): {
video: MediaStreamTrack;
audio: MediaStreamTrack;
};
/**
* @description Start recording the meeting
* @param {string} sourceUrl required
*/
startRecording(sourceUrl: string): void;
/**
* @description Stop recording the meeting, if ipfs is true, the recording will be uploaded to ipfs
* @param {boolean} ipfs optional
*/
stopRecording(ipfs?: boolean | undefined): void;
/**
* @description Set the display name of the current user
* @param {string} displayName required
*/
setDisplayName(displayName: string): void;
/**
* @description Set the avatar of the current user
* @param {string} avatarUrl required
*/
setAvatar(avatarUrl: string): void;
/**
* @description Send data to other peers, if peerIds is '*', the data will be sent to all peers
* @param {string[] | '*'} peerIds required, '*' or array of peerIds
* @param {unknown} data required
*/
sendData(peerIds: string[] | '*', data: unknown): void;
/**
* @description Change the role of a peer to be a speaker
* @param peerId peerId to change role to speaker
*/
createSpeaker(peerId: string): void;
/**
* @description Change the role of a peer to be a listener
* @param peerId peerId to change role to listener
*/
createListener(peerId: string): void;
/**
* @description Change the role of a peer to be a cohost
* @param peerId peerId to change role to cohost
*/
createCohost(peerId: string): void;
/**
*
* @param {TRoomControls} type room wide control type
* @param value boolean value
*/
hostControl(type: TRoomControls, value: boolean): void;
/**
* @description Remove a peer from the meeting
* @param peerId peerId to kick
*/
kickPeer(peerId: string): void;
}
//# sourceMappingURL=AudioSpacesClient.d.ts.map