UNPKG

callskit

Version:

A toolkit for building call experience using Cloudflare Realtime

90 lines (84 loc) 2.47 kB
import { S as SerializedUser, C as ChatMessage, a as ChatMessagePayload, L as Logger, b as CallClientOptions, c as CallClient } from './call-client-BaqHhJ3j.cjs'; export { h as CallChat, g as CallChatEvents, f as CallParticipant, e as CallSelf, d as CallSelfOptions, V as VideoEncodingRid } from './call-client-BaqHhJ3j.cjs'; import PartySocket, { PartySocketOptions } from 'partysocket'; type RoomEvent = { event: 'connected'; } | { event: 'room/init'; participants: SerializedUser[]; started_at: string; chatMessages: ChatMessage[]; }; type ParticipantEvent = { event: 'participant/joined'; participant: SerializedUser; } | { event: 'participant/left'; participantId: string; } | { event: 'participant/camera-update'; data: { cameraEnabled: boolean; cameraTrackId?: string; participantId: string; }; } | { event: 'participant/mic-update'; data: { micEnabled: boolean; micTrackId?: string; participantId: string; }; } | { event: 'participant/screenshare-update'; data: { screenshareEnabled: boolean; screenshareVideoTrackId?: string; screenshareAudioTrackId?: string; participantId: string; }; }; type ChatEvent = { event: 'chat/new-message'; message: ChatMessage; }; type CallEvent = RoomEvent | ParticipantEvent | ChatEvent; type MediaAction = { action: 'self/mic-update'; updates: { micEnabled: boolean; micTrackId?: string; }; } | { action: 'self/camera-update'; updates: { cameraEnabled: boolean; cameraTrackId?: string; }; } | { action: 'self/screenshare-update'; updates: { screenshareEnabled: boolean; screenshareVideoTrackId?: string; screenshareAudioTrackId?: string; }; }; type ChatAction = { action: 'chat/message'; message: ChatMessagePayload; }; type CallAction = { action: 'join'; self: SerializedUser; } | { action: 'leave'; } | MediaAction | ChatAction; declare class CallSocket extends PartySocket { #private; constructor(options: PartySocketOptions & { logger: Logger; }); sendAction(action: CallAction): void; } declare function createCallClient(options: CallClientOptions): Promise<CallClient>; export { type CallAction, CallClient, CallClientOptions, type CallEvent, CallSocket, ChatMessage, ChatMessagePayload, SerializedUser, createCallClient };