vue-peer
Version:
With this package, you can have video calls along with two or multi-person chat communication. You can easily bind and display your streams in any video element you want.
39 lines (38 loc) • 1.61 kB
TypeScript
import { AcceptedEvent, ErrorEvent, LocalVideoEvent, MessageEvent, MetadataType, UserJoinedEvent, VuePeerEvent, VuePeerOption, VuePeerSocketEvent } from './vue-peer.types';
export declare class VuePeer<TMetadata, TMessage extends {
fromMetadata?: MetadataType<TMetadata>;
to?: string;
}> {
private localStream;
private socket;
private call;
private peerId;
private metadata;
private user;
private room;
private onAccepted;
private showLogs;
private peer;
private peerConnections;
private try;
events: Partial<Record<VuePeerSocketEvent, VuePeerEvent<TMetadata, TMessage>>>;
constructor(options: VuePeerOption<TMetadata>);
on(event: VuePeerSocketEvent.ERROR_IN_NAVIGATOR, callback: ErrorEvent): void;
on(event: VuePeerSocketEvent.ERROR_IN_PEER, callback: ErrorEvent): void;
on(event: VuePeerSocketEvent.ERROR_IN_SOCKET, callback: ErrorEvent): void;
on(event: VuePeerSocketEvent.LOCAL_VIDEO, callback: LocalVideoEvent): void;
on(event: VuePeerSocketEvent.USER_JOINED, callback: UserJoinedEvent<TMetadata>): void;
on(event: VuePeerSocketEvent.MESSAGE, callback: MessageEvent<TMessage>): void;
on(event: VuePeerSocketEvent.ON_ACCEPTED, callback: AcceptedEvent<TMetadata>): void;
sendMessageToAll(_data: TMessage): void;
sendMessageTo(userId: string, _data: TMessage): void;
disconnect(): void;
private configPeer;
private configNavigator;
private configSocket;
private callStreamEvent;
private callErrorEvent;
private callJoinUserEvent;
private callDisconnect;
private log;
}