UNPKG

@4players/odin

Version:

A cross-platform SDK enabling developers to integrate real-time VoIP chat technology into their projects

52 lines (51 loc) 1.76 kB
import { OdinStreamHandler, OdinStream } from './stream'; import { OdinAudioContextConfig } from './types'; /** * Opens a new ODIN main/room stream and registers events handlers. * * @param url The URL to the main/room stream server * @param handler The handler for ODIN events * @returns The new steam */ export declare function openStream(url: string, handler: OdinStreamHandler): Promise<OdinStream>; /** * Validates and parses a given JWT and returns its claims. * * @param token The JWT to parse * @returns The payload */ export declare function parseJwt(token: string): any; /** * Encodes a value or an object with the help of JSON.stringify to an Uint8Array. * * @param value Value or object to encode * @returns The Uint8Array encoded value */ export declare function valueToUint8Array(value: any): Uint8Array; /** * Decodes a Uint8Array. * * @param bytes Byte array to decode * @returns The decoded value or undefined on error */ export declare function uint8ArrayToValue(bytes: Uint8Array): unknown; /** * Creates new audio contexts for both audio input and output. * If the sample rate of the input device is 48 kHz, we can use the same audio context for both. * * @param input Current input audio context * @returns The new set of audio contexts */ export declare function setupDefaultAudioContext(input: AudioContext): OdinAudioContextConfig; /** * Tests the user agent against a valid pattern for Blink-based browsers. * * @returns True if we're using a Blink browser */ export declare function isBlinkBrowser(): boolean; /** * Generate a random point inside a unit sphere. * * @return The new position */ export declare function randomPointInUnitSphere(): [number, number, number];