@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
68 lines (67 loc) • 2.63 kB
TypeScript
import { Behaviour } from "./Component.js";
export declare const noVoip = "noVoip";
/**
* The Voice over IP component (VoIP) allows you to send and receive audio streams to other users in the same networked room.
* It requires a networking connection to be working (e.g. by having an active SyncedRoom component in the scene or by connecting to a room manually).
* @category Networking
* @group Components
*/
export declare class Voip extends Behaviour {
/** When enabled, VoIP will start when a room is joined or when this component is enabled while already in a room.
* @default true
*/
autoConnect: boolean;
/**
* When enabled, VoIP will stay connected even when the browser tab is not focused/active anymore.
* @default true
*/
runInBackground: boolean;
/**
* When enabled, a menu button will be created to allow the user to toggle VoIP on and off.
*/
createMenuButton: boolean;
/**
* When enabled debug messages will be printed to the console. This is useful for debugging audio issues. You can also append ?debugvoip to the URL to enable this.
*/
debug: boolean;
private _net?;
private _menubutton?;
/** @internal */
awake(): void;
/** @internal */
onEnable(): void;
/** @internal */
onDisable(): void;
/** @internal */
onDestroy(): void;
/** Set via the mic button (e.g. when the websocket connection closes and rejoins but the user was muted before we don't want to enable VOIP again automatically) */
private _allowSending;
private _outputStream;
/**
* @returns true if the component is currently sending audio
*/
get isSending(): boolean;
/** Start sending audio. */
connect(audioSource?: MediaTrackConstraints): Promise<boolean>;
/** Stop sending audio (muting your own microphone) */
disconnect(opts?: {
remember: boolean;
}): void;
/**
* Mute or unmute the audio stream (this will only mute incoming streams and not mute your own microphone. Use disconnect() to mute your own microphone)
*/
setMuted(mute: boolean): void;
/** Returns true if the audio stream is currently muted */
get isMuted(): boolean;
private updateButton;
/** @deprecated */
getFrequency(_userId: string | null): number | null;
private getAudioStream;
private onJoinedRoom;
private onLeftRoom;
private _incomingStreams;
private onReceiveStream;
private onStreamEnded;
private onEnabledChanged;
private onVisibilityChanged;
}