@4players/odin
Version:
A cross-platform SDK enabling developers to integrate real-time VoIP chat technology into their projects
73 lines (72 loc) • 2.75 kB
TypeScript
import { Peer } from './index';
import { AudioOutput } from '../media/audio-output';
import { VideoOutput } from '../media/video-output';
import { Peer as PeerData } from '@4players/odin-common/schema/peer';
import { Room } from '../room';
import { Backend } from '@4players/odin-common';
import PlaybackVolume = Backend.PlaybackVolume;
/**
* Represents a RemotePeer, which extends functionality from the Peer class. A RemotePeer
* is associated with audio outputs as well as data and messages exchanged in the room.
* It provides utilities to manage playback volume, user data, and message communication with the remote peer.
*/
export declare class RemotePeer extends Peer {
#private;
protected _peerData: PeerData;
readonly room: Room;
readonly isRemote = true;
/**
* 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;
/**
* Determines if any of the audio outputs related to this peer are currently active.
*
* @return {boolean} True if at least one of the related audio outputs is active, otherwise false.
*/
get isActive(): boolean;
/**
* Retrieves the highest power level from the related audio outputs.
*
* @return {number} The highest power level among all audio outputs.
*/
get powerLevel(): number;
/**
* Gets the current volume of the LocalPeer.
*
* @return {PlaybackVolume} The current volume.
*/
get volume(): PlaybackVolume;
/**
* Retrieves the list of audio output devices associated with this Peer.
*
* @return {AudioOutput[]} An array of AudioOutput objects related to this Peer.
*/
get audioOutputs(): AudioOutput[];
/**
* Retrieves the list of VideoOutput objects associated with this Peer.
*
* @return {VideoOutput[]} An array of VideoOutput objects. Returns an empty array if no video outputs are associated.
*/
get videoOutputs(): VideoOutput[];
constructor(_peerData: PeerData, room: Room);
/**
* Sets the volume for the playback.
*
* @param {PlaybackVolume|number} value - The desired volume level. It can be a number or left and right channel [number, number].
*/
setVolume(value: PlaybackVolume | number): void;
/**
* Sends a message with arbitrary data to this peer.
*
* @param {Uint8Array} message - The message to be sent as a byte array.
* @return {Promise<void>} A promise that resolves when the message is sent successfully.
*/
sendMessage(message: Uint8Array): Promise<void>;
}