@4players/odin
Version:
A cross-platform SDK enabling developers to integrate real-time VoIP chat technology into their projects
65 lines (64 loc) • 2.39 kB
TypeScript
import { Peer as PeerData } from '@4players/odin-common/schema/peer';
import { Room } from '../room';
import { Peer } from './index';
import { Backend } from '@4players/odin-common';
import { AudioInput } from '../media/audio-input';
import CaptureVolume = Backend.CaptureVolume;
/**
* Represents the local peer connected to a room. This class extends the base Peer class and includes
* functionality specific to the local peer, such as adjusting audio input volumes and managing user data.
*/
export declare class LocalPeer extends Peer {
#private;
protected _peerData: PeerData;
readonly room: Room;
readonly isRemote = false;
/**
* Gets the current volume of the LocalPeer.
*
* @return {CaptureVolume} The current volume.
*/
get volume(): CaptureVolume;
/**
* Determines if any of the audio inputs are currently active.
*
* @return {boolean} True if at least one audio input is active, otherwise false.
*/
get isActive(): boolean;
/**
* Retrieves the highest power level among the audio inputs.
*
* @return {number} The highest power level detected across all audio inputs.
*/
get powerLevel(): number;
/**
* Retrieves the list of AudioInput devices associated with this Peer.
*
* @return {AudioInput[]} An array of AudioInput objects. Returns an empty array if the instance is remote.
*/
get audioInputs(): AudioInput[];
/**
* Set updated user data for the peer.
*/
set data(data: Uint8Array);
/**
* The arbitrary user data of the peer.
*
* @return {Uint8Array} The appropriate Uint8Array data based on the context.
*/
get data(): Uint8Array;
constructor(_peerData: PeerData, room: Room);
/**
* Sets the volume for all associated Medias of this Peer.
*
* @param {CaptureVolume} value - The new volume level to set.
* @return {Promise<void>} A promise that resolves when the volume is set for all medias.
*/
setVolume(value: CaptureVolume): Promise<void>;
/**
* Updates the current user's data by flushing it to the associated room.
*
* @return {Promise<void>} Resolves when the user data has been successfully updated, or rejects with an error if the user is a remote peer or if the operation encounters an issue.
*/
update(): Promise<void>;
}