import type { CreateRecordingPersonRequest, ListRecordingModelsResponse, Recording, RecordingCreateTitleSource, RecordingLiveSegment, RecordingNote, RecordingNoteKind, RecordingPerson, RecordingVoiceprintConsent, RecordingSpeaker, RecordingTranscriptionRequest, RecordingTranscriptSegment, RecordingTranscriptVersion, RecordingVisibility, UpdateRecordingRequest } from "@opengeni/contracts"; import { OpenGeniRecordingsClient, type RecorderPlatform, type RecorderSnapshot, type RecordingChunkStore, type RecordingUploadStatus, type SystemAudioKind } from "@opengeni/sdk/recordings"; /** * Client surface of the recording hooks, as `OpenGeniRecordingsClient` provides * it. Each hook checks only the methods it calls, so a host proxy can expose a subset. */ export type RecordingsClientLike = Pick; export type RecordingsClientOverride = { /** A recordings client, such as a host proxy. Built from the provider's client otherwise. */ recordings?: Partial | undefined; /** A client exposing `requestJson` (the SDK client) to build the recordings client from. */ client?: object | undefined; workspaceId?: string | undefined; }; /** * The recordings client the hooks use, for calls no hook wraps (deleting from * a list, reading track audio): the explicit `recordings` client, else one * built over the provider's SDK client. */ export declare function useRecordingsClient(options?: RecordingsClientOverride): { client: RecordingsClientLike; workspaceId: string; }; export type UseRecorderOptions = RecordingsClientOverride & { /** Leave it out unless the person gave one; Opengeni then names the meeting. */ title?: string; /** `app` when `title` is your app's guess, such as "Zoom meeting", for Opengeni to replace. */ titleSource?: RecordingCreateTitleSource; visibility?: RecordingVisibility; /** Your own id for what this recording belongs to, to find it again with `useRecordings`. */ externalRef?: string; metadata?: Record; transcription?: RecordingTranscriptionRequest; /** * The person recording's name, as your app knows it: their microphone's * name in the transcript when computer or tab audio is recorded beside it * and Opengeni has no name for them. */ ownerName?: string; /** Microphone constraints; false records no microphone. Default: on. */ microphone?: boolean | MediaTrackConstraints; /** Also record shared tab or system audio as its own track (Chromium). Default: off. */ systemAudio?: boolean; timesliceMilliseconds?: number; keepAwake?: boolean; /** * Also show a live transcript while recording, in `live`: each track is * streamed to the workspace's live speech model as it is captured, which * the provider bills for. A preview only. Default: off. */ liveTranscript?: boolean; /** * Where capture runs. Default: the browser (MediaRecorder and IndexedDB). * React Native passes `useNativeRecorderPlatform()` from `@opengeni/react-native/recordings`. */ platform?: RecorderPlatform; /** Local storage for chunks not uploaded yet. Default: the platform's (IndexedDB in browsers). */ store?: RecordingChunkStore; /** Finish recordings an earlier page left behind when the hook mounts. Default: on. */ resumePending?: boolean; /** Called once the server has every chunk of a recording and transcription has started. */ onFinished?: (recordingId: string) => void; }; export type UseRecorderResult = RecorderSnapshot & { /** This browser can record audio at all. */ supported: boolean; /** This browser can share a tab's or the system's audio. */ systemAudioSupported: boolean; /** * How: `desktop` records other apps' audio directly (inside a desktop app); * `display` asks the browser to share a tab or screen. Null when it can't. */ systemAudioKind: SystemAudioKind | null; /** * Recordings from an earlier page or app run this hook is still finishing in * the background. Each leaves the list once it is uploaded, removed for having * no audio, or failed for good. */ recovered: string[]; /** * The upload of every recording this device holds audio for, by recording * id: the current one and those finished in the background, including one * that failed and keeps its audio here until it is tried again. */ uploads: Readonly>; /** Upload a failed recording again from the audio kept here. False when none failed. */ retryUpload: (recordingId: string) => boolean; /** Start a new recording; per-recording options override the hook's. */ start: (overrides?: Pick) => Promise; pause: () => void; resume: () => void; stop: () => Promise; discard: () => Promise; /** Rename the recording being made; the title reaches the server with the upload. */ rename: (title: string) => Promise; /** Input level per track number, 0 to 1. Read it from an animation frame for a meter. */ levels: () => Record; /** * Make a meeting from audio recorded somewhere else, such as a phone's call * recording or a voice memo. It goes the way a capture does: saved on this * device first, then uploaded in the background and transcribed, and it * shows in `uploads` while it uploads. Resolves with the new recording's id * once the audio is saved here; a capture under way is not affected. */ importAudio: (input: ImportRecordingAudioInput) => Promise; }; export type ImportRecordingAudioInput = { /** One audio file: M4A (MP4), WebM, Ogg or ADTS AAC. */ audio: Blob; /** Its type; the blob's own type by default. */ mimeType?: string; /** The meeting's name. Opengeni names it when omitted. */ title?: string; /** `app` when `title` is a guess, such as the file's name, for Opengeni to replace. */ titleSource?: RecordingCreateTitleSource; /** * When it was recorded, if known. By default the date an M4A file states, * otherwise it ended just now. */ startedAt?: Date; /** How long it plays. Read from an M4A file when omitted. */ durationMilliseconds?: number; /** Recorded with this id (a project, a customer). The hook's `externalRef` otherwise. */ externalRef?: string; }; /** * Record a meeting in the browser. Audio is saved locally every few seconds * and uploaded in the background, so a reload or a lost connection loses * nothing. Unmounting while recording stops capture (the microphone is * released) and finishes the upload in the background; keep the hook in a * component that outlives page navigation to record across it. */ export declare function useRecorder(options?: UseRecorderOptions): UseRecorderResult; export type UseRecordingsOptions = RecordingsClientOverride & { query?: string; externalRef?: string; limit?: number; pollIntervalMs?: number; enabled?: boolean; }; export type UseRecordingsResult = { recordings: Recording[]; loading: boolean; error: Error | null; refresh: () => Promise; hasMore: boolean; loadingMore: boolean; loadMore: () => Promise; }; /** * The recordings the signed-in person can see, newest first. Polls while any is * being transcribed, and less often while any is still being recorded. */ export declare function useRecordings(options?: UseRecordingsOptions): UseRecordingsResult; export type UseRecordingOptions = RecordingsClientOverride & { enabled?: boolean; }; export type UseRecordingResult = { recording: Recording | null; versions: RecordingTranscriptVersion[]; loading: boolean; error: Error | null; /** Transcription is still running; the hook polls until it is done. */ processing: boolean; refresh: () => Promise; update: (request: UpdateRecordingRequest) => Promise; /** Transcribe again, optionally with another model, as a new version. */ rerun: (transcription?: RecordingTranscriptionRequest) => Promise; setCurrentVersion: (versionId: string) => Promise; remove: () => Promise; }; /** * One recording with its transcript versions. Polls while it is being * transcribed, and less often while it is still being recorded, here or on * another device, so a page showing it notices when the recording ends. */ export declare function useRecording(recordingId: string | null, options?: UseRecordingOptions): UseRecordingResult; export type UseLiveTranscriptOptions = RecordingsClientOverride & { /** Default: on while a recording id is given. */ enabled?: boolean; }; export type UseLiveTranscriptResult = { /** Finished live text from every track, in time order. */ segments: RecordingLiveSegment[]; /** A transcript is ready, so the preview is over. */ ended: boolean; error: Error | null; }; /** * The live transcript of a recording someone is capturing, as the recorder * saves it, for viewers on other devices. Polls every two seconds until the * transcript is ready. The device recording has it sooner in `useRecorder().live`. */ export declare function useLiveTranscript(recordingId: string | null, options?: UseLiveTranscriptOptions): UseLiveTranscriptResult; export type UseTranscriptOptions = RecordingsClientOverride & { /** A specific version; the current one by default. */ versionId?: string; /** Change it to read again, for example when a new version completes. */ refreshKey?: unknown; enabled?: boolean; }; export type UseTranscriptResult = { version: RecordingTranscriptVersion | null; speakers: RecordingSpeaker[]; segments: RecordingTranscriptSegment[]; loading: boolean; error: Error | null; refresh: () => Promise; /** Name a speaker label after a person in the directory or with a plain name; null clears it. */ nameSpeaker: (label: string, name: { personId: string; } | { name: string; } | null) => Promise; /** Turn down a voice suggestion; that person is not suggested for this voice again. */ rejectSuggestion: (label: string) => Promise; /** Move one segment to another speaker label. */ moveSegment: (segmentIndex: number, label: string) => Promise; /** Correct one segment's text; null restores the original. */ editSegment: (segmentIndex: number, text: string | null) => Promise; }; /** A whole transcript version with its speakers, and the edits people make to it. */ export declare function useTranscript(recordingId: string | null, options?: UseTranscriptOptions): UseTranscriptResult; /** The organization's people directory, to name speakers with. */ export declare function useRecordingPeople(options?: RecordingsClientOverride & { query?: string; enabled?: boolean; }): { people: RecordingPerson[]; loading: boolean; error: Error | null; refresh: () => Promise; create: (request: CreateRecordingPersonRequest) => Promise; /** Agree to have a person's voice remembered (see rememberRecordingPersonVoice). */ rememberVoice: (personId: string, consent: RecordingVoiceprintConsent) => Promise; /** Forget a person's voice and withdraw their agreement. */ forgetVoice: (personId: string) => Promise; }; /** * Models this workspace offers, with capabilities, price and the default: * `models` make transcripts; `liveModels` stream the live transcript. */ export declare function useRecordingModels(options?: RecordingsClientOverride & { enabled?: boolean; }): { models: ListRecordingModelsResponse["models"]; liveModels: ListRecordingModelsResponse["models"]; defaultModel: ListRecordingModelsResponse["default"] | null; /** The deployment uses one model for every transcription; workspaces cannot pick. */ pinned: boolean; /** * The workspace's meeting language (null detects it), or undefined until * the server says, or when it is too old to. */ language: string | null | undefined; /** * Whether the workspace's recorders start with the live transcript on, or * undefined until the server says, or when it is too old to. */ liveTranscript: boolean | undefined; loading: boolean; error: Error | null; }; export type UseRecordingNotesOptions = RecordingsClientOverride & { enabled?: boolean; /** Check for notes saved elsewhere this often; default 15 seconds, 0 to never. */ pollIntervalMs?: number; }; export type UseRecordingNotesResult = { /** What people jotted down while the meeting was recorded. */ notepad: RecordingNote | null; /** The written-up summary, decisions and action items. */ notes: RecordingNote | null; loading: boolean; error: Error | null; refresh: () => Promise; /** * Replace the notepad or the notes. The notes are saved against the revision * this hook last read, so a newer save made elsewhere fails with 409 * `notes_changed` instead of being overwritten; the notepad, saved as people * type, always wins. */ save: (kind: RecordingNoteKind, body: string) => Promise; }; /** A meeting's notepad and notes, kept fresh while it is open. */ export declare function useRecordingNotes(recordingId: string | null, options?: UseRecordingNotesOptions): UseRecordingNotesResult;