@4players/odin
Version:
A cross-platform SDK enabling developers to integrate real-time VoIP chat technology into their projects
30 lines (29 loc) • 1.51 kB
TypeScript
import { Backend } from '@4players/odin-common';
import Plugin = Backend.Plugin;
export declare let PLUGIN: Backend.Plugin | undefined;
export declare const SUPPORTED_API_VERSION: Backend.Version;
/**
* Ensures a plugin is available for the SDK. If no plugin is provided, a default web plugin is created
* using `@4players/odin-plugin-web`.
*
* If the plugin is already registered, the existing plugin is returned immediately.
* If registration is in progress (e.g. from a concurrent call), the same pending promise is returned.
*
* @param {Plugin} [plugin] - An optional plugin instance. When omitted, a default web plugin is created automatically.
* @returns {Promise<Plugin>} A promise that resolves to the registered plugin.
*/
export declare function ensurePlugin(plugin?: Plugin): Promise<Plugin>;
/**
* Replaces the current plugin with a new one. Unlike {@link ensurePlugin}, this always overwrites
* the existing plugin, even if one is already registered.
*
* @param {Plugin} plugin - The plugin instance to use. Must match the supported API version.
*/
export declare function replacePlugin(plugin: Plugin): void;
/**
* Sets the audio output device globally across all rooms.
*
* @param {Backend.DeviceParameters} [device={}] - The parameters of the audio output device to be set.
* @returns {Promise<void>} A promise that resolves when the audio output device has been successfully set.
*/
export declare function setOutputDevice(device?: Backend.DeviceParameters): Promise<void>;