import type { JanusJS } from 'janus-gateway-ts'; import type { Readable } from 'svelte/store'; import type { PublishSpec } from './publish/factory'; import type { PluginHandle, Handle } from '../../attach'; import type { Peers } from './subscribe'; export declare const VIDEO_ROOM = "janus.plugin.videoroom"; export declare type RoomId = number; export declare type DisplayName = string | undefined; export declare type RoomPin = string | undefined; /** * The properties exposed when the component attached */ export declare type AttachEvent = { publish: InitPublish; peers: Readable; }; /** * Our parameters for how to join a room. Both username and pin are optional */ export declare type RoomOptions = { room: number; pin?: string; username?: string; }; /** * This is the type we receive in the `publishers` payload of a join response */ export declare type Publisher = { id: number; display?: string; talking?: boolean; video_codec?: string; audio_codec?: string; }; /** * The structure of messages received from VideoRoom */ export declare type Message = { videoroom: string; id?: string; description?: string; private_id?: string; publishers?: Publisher[]; room?: number; unpublished?: number; leaving?: number; error?: string; error_code?: number; }; /** * The signature of the function to initialise a publish handle */ export declare type InitPublish = (opaqueId: string) => Promise>; /** * The signature of the function to initialise a subscribe handle */ export declare type InitSubscribe = (opaqueId: string, feedId: number) => Promise>; /** * Composite type of the two functions above */ export declare type HandleFactory = { publish: InitPublish; subscribe: InitSubscribe; }; /** * When joining a room, you can join either as a publisher or subsriber. * If subscriber, the feed identifier to which you're subscribing must be given. */ export declare type JoinOptions = { ptype: 'publisher'; } | { ptype: 'subscriber'; feed: number; }; /** * Generic function signature for attaching a new handle */ export declare type MakeHandle = (opaqueId: string, options: JoinOptions, makePlugin: (handle: Handle, msg: Message, jsep: JanusJS.JSEP) => T) => Promise>; /** * Factory function for generating a HandleFactory function. A factory factory, if you will. */ export default function (janus: JanusJS.Janus, { room, pin, username }: RoomOptions): HandleFactory; export * as Pub from './publish'; export * as Sub from './subscribe'; export { default as VideoRoom } from './index.svelte'; export { Publish } from './publish'; export { Peer } from './subscribe';