UNPKG

msg91-webrtc-call

Version:

**msg91-webrtc-call** is a lightweight JavaScript SDK that enables you to easily add peer-to-peer WebRTC audio/video calling functionality to your web applications using the MSG91 infrastructure.

45 lines (44 loc) 1.25 kB
declare class EventEmitter { private eventListeners; on(event: string, callback: (data: any) => void): { remove: () => void; }; emit(event: string, data?: any): void; removeListener(channel: string, listener: any): void; } export declare enum CALL_EVENT { ENDED = "ended", ANSWERED = "answered", REJOINED = "rejoined", UNAVAILABLE = "unavailable", ERROR = "error", CONNECTED = "connected", MUTE = "mute", UNMUTE = "unmute", MESSAGE = "message" } export declare enum WebRTC_EVENT { CALL = "call", INCOMING_CALL = "incoming-call", OUTGOING_CALL = "outgoing-call", PLAY_RINGTONE = "play-ringtone", STOP_RINGTONE = "stop-ringtone" } declare class WebRTC extends EventEmitter { private user; private callId; private status; private userToken; private callToken?; private callManager; constructor(userToken: string); close(): void; call(callToken: string): Promise<void>; rejoinCall(callId: string): Promise<void>; sendUserContext(data: { context?: any; message?: any; }): Promise<void>; } declare const _default: (userToken: string, env?: "dev" | "test" | "prod") => WebRTC | undefined; export default _default;