import { Observable } from 'rxjs'; import { type HeadlessParameters, type ProducerKind } from 'mediasfu-shared'; import * as i0 from "@angular/core"; /** * The Angular equivalent of the React SDK's `useMediasfuHeadless`. * * Field names deliberately mirror the hook one-for-one, so every recipe in * HEADLESS_GUIDE.md reads the same here — only the reactivity idiom changes * (observables instead of hook state). * * Two rules are baked in, and they are where most headless integrations go * wrong: * * - **Take every publication.** Each field on the bag is a snapshot of an * internal ref the SDK reassigns, so a bag you hold is stale the moment a * producer changes. De-duplicating (`distinctUntilChanged`) or deep-comparing * publications freezes your view on whatever it rendered first — do not add * it to these streams. * - **Keep `sourceParameters` stable.** The object handed to the component is a * seed it writes through; a fresh object per change-detection pass makes the * SDK re-render and can loop. This service keeps one seed. * * Provided in root, but you can also provide it per-component to scope one * instance to one call surface. * * @example * ```ts * export class CallComponent { * constructor(public room: MediasfuHeadlessService) {} * } * ``` * ```html * * * * ``` */ export declare class MediasfuHeadlessService { /** Bind to the component's `[sourceParameters]`. Stable for the lifetime. */ readonly sourceParameters: HeadlessParameters; private readonly parameters$$; private readonly sourceChanged$$; /** The latest bag. Read it; do not hold it across publications. */ readonly parameters$: Observable; /** Increments on every publication. */ readonly sourceChanged$: Observable; readonly readiness$: Observable; readonly ready$: Observable; readonly localVideo$: Observable; readonly localAudio$: Observable; readonly remoteVideos$: Observable; readonly screenShare$: Observable; /** Render all of these (hidden is fine) or participants will be inaudible. */ readonly audioComponents$: Observable; readonly participants$: Observable; readonly micOn$: Observable; readonly cameraOn$: Observable; readonly permissions$: Observable; readonly recording$: Observable; readonly whiteboard$: Observable; readonly polls$: Observable; readonly breakout$: Observable; /** * Bind to the component's `[updateSourceParameters]`. * * An arrow property, not a method: it is handed to the component as a value * and would otherwise lose `this`. */ readonly updateSourceParameters: (next: HeadlessParameters) => void; /** Bind to the component's `(mediaChanged)`. Removes any need to poll. */ readonly onMediaChanged: (info: { reasons: string[]; parameters: HeadlessParameters; }) => void; /** Read the newest bag at call time so actions never use a stale one. */ private live; readonly controls: { toggleMic: () => Promise; toggleCamera: () => Promise; toggleScreenShare: () => Promise; selectMic: (deviceId: string) => Promise; selectCamera: (deviceId: string) => Promise; flipCamera: () => Promise; sendChat: (message: string, options?: { receivers?: string[]; group?: boolean; }) => Promise; leave: (ban?: boolean, endRoomOnHostExit?: boolean) => Promise; }; readonly moderation: { muteParticipant: (name: string) => Promise; disableParticipantVideo: (name: string) => Promise; stopParticipantScreenShare: (name: string) => Promise; setParticipantMedia: (name: string, kind: "audio" | "video" | "screenshare" | "all") => Promise; muteEveryone: (kind?: "audio" | "video" | "screenshare" | "all") => Promise; removeParticipant: (name: string) => Promise; admitWaiting: (nameOrId: string) => Promise; denyWaiting: (nameOrId: string) => Promise; approveRequest: (requestId: string) => Promise; rejectRequest: (requestId: string) => Promise; setCoHost: (name: string, areas?: any[]) => Promise; }; readonly session: { startRecording: () => Promise; pauseRecording: () => Promise; resumeRecording: () => Promise; stopRecording: () => Promise; startWhiteboard: (users?: any[]) => Promise; stopWhiteboard: () => Promise; createPoll: (question: string, options: string[]) => Promise; votePoll: (pollId: string, optionIndex: number) => Promise; endPoll: (pollId: string) => Promise; }; readonly produce: { media: (stream: MediaStream, kind: ProducerKind) => Promise; canvas: (canvas: HTMLCanvasElement, frameRate?: number) => Promise; element: (element: HTMLMediaElement) => Promise; display: (withAudio?: boolean) => Promise; replaceTrack: (track: MediaStreamTrack) => Promise; stop: (kind: ProducerKind) => Promise; }; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; }