Vidtreo

Types Reference

TypeScript type definitions for the VIDTREO SDK.

Types Reference

All TypeScript types exported by the VIDTREO SDK packages.

Core Types

RecordingState

type RecordingState = 'idle' | 'countdown' | 'recording';

SourceType

type SourceType = 'camera' | 'screen';

RecordingStopResult

interface RecordingStopResult {
  recordingId: string;  // Unique recording identifier
  uploadUrl: string;    // Direct URL to the video
  blob: Blob;           // Local video blob
  integrity?: IntegrityReport;  // with integrity.enabled: the report sent with the upload
}

RecordingMarkerInput / RecordingMarker

interface RecordingMarkerInput {
  id: string;     // 1–64 characters, unique within the recording
  label: string;  // 1–500 characters
}

interface RecordingMarker extends RecordingMarkerInput {
  time: number;   // seconds from the start of the recording, paused time excluded
}

See Recording Markers.

IntegrityOptions / IntegrityReport

interface IntegrityOptions {
  enabled: boolean;
  policy?: 'report' | 'warn' | 'block';           // default 'report'
  challenges?: {
    enabled: boolean;
    count?: number;                                // default 1; at most 25 gestures or 50 read-words
    windowSeconds?: number;                        // default 8
    delaySeconds?: { min: number; max: number };   // default 10 to 40
    types?: Array<'turn-head-left' | 'turn-head-right' | 'hand-over-face' | 'read-words'>;
    seed?: string;
    lang?: 'en' | 'es';
    burnIn?: boolean;                              // default true
  };
}

interface IntegritySignal {
  code: IntegritySignalCode;    // e.g. "session.tab-hidden"
  start: number;                // seconds from the start of the recording, paused time excluded
  end: number | null;           // null for an instant
  confidence: 'low' | 'medium' | 'high' | 'insufficient';
  source: 'sdk' | 'server';
  detail: Record<string, string | number | boolean>;
}

interface IntegrityReport {
  version: 1;
  policy: 'report' | 'warn' | 'block';
  recorder: { version: string; route: 'local-webcodecs' | 'safe-capture' };
  capture: {
    startedAt: string;
    devices: IntegrityDevice[];
    frameTiming: FrameTiming | null;
    challenges: IntegrityChallenge[];
    manifest: IntegrityManifest | null;
  };
  signals: IntegritySignal[];
  truncated: boolean;
}

IntegrityChallengePrompt ({ id, type, text, shownAt, windowSeconds, alternative }) and IntegrityBlockedReason ({ code, label, pattern }) are the payloads of onIntegrityChallenge and onIntegrityBlocked. See Capture Integrity for every field and signal code.

AvailableDevices

interface AvailableDevices {
  video: MediaDeviceInfo[];  // Available cameras
  audio: MediaDeviceInfo[];  // Available microphones
}

Configuration Types

VidtreoRecorderConfig

interface VidtreoRecorderConfig {
  apiKey: string;
  apiUrl?: string;
  enableSourceSwitching?: boolean;
  enableMute?: boolean;
  enablePause?: boolean;
  enableDeviceChange?: boolean;
  maxRecordingTime?: number;
  countdownDuration?: number;
  userMetadata?: Record<string, unknown>;
  enableTabVisibilityOverlay?: boolean;
  tabVisibilityOverlayText?: string;

  onUploadComplete?: (result: UploadCompleteResult) => void;
  onUploadProgress?: (progress: number) => void;
  onUploadError?: (error: Error) => void;
  onRecordingStart?: () => void;
  onRecordingStop?: () => void;
  onError?: (error: Error) => void;
  integrity?: IntegrityOptions;
  onIntegritySignal?: (signal: IntegritySignal) => void;
  onIntegrityBlocked?: (reason: IntegrityBlockedReason) => void;
  onIntegrityChallenge?: (prompt: IntegrityChallengePrompt) => void;
  onIntegrityChallengeEnd?: (id: string) => void;
}

RecordingStartOptions

interface RecordingStartOptions {
  video?: {
    width?: number;
    height?: number;
    frameRate?: number;
  };
  audio?: boolean | MediaTrackConstraints;
}

TranscodeConfig

interface TranscodeConfig {
  format: 'mp4' | 'webm' | 'mkv';
  fps: number;
  width: number;
  height: number;
  bitrate: number;
  audioCodec: string;
  audioBitrate: number;
}

React Types

VidtreoRecorderProps

interface VidtreoRecorderProps {
  apiKey?: string;
  backendUrl?: string;
  countdownDuration?: number;
  maxRecordingTime?: number;
  userMetadata?: Record<string, unknown>;
  enableSourceSwitching?: boolean;
  enableMute?: boolean;
  enablePause?: boolean;
  enableDeviceChange?: boolean;
  enableTabVisibilityOverlay?: boolean;
  demo?: boolean;
  lang?: string;
  texts?: PartialTranslations;

  onUploadComplete?: (result: UploadCompleteResult) => void;
  onUploadProgress?: (progress: number) => void;
  onUploadError?: (error: Error) => void;
  onRecordingStart?: () => void;
  onRecordingStop?: () => void;
  onError?: (error: Error) => void;
  integrity?: IntegrityOptions;
  onIntegritySignal?: (signal: IntegritySignal) => void;
  onIntegrityBlocked?: (reason: IntegrityBlockedReason) => void;
  onIntegrityChallenge?: (prompt: IntegrityChallengePrompt) => void;
  onIntegrityChallengeEnd?: (id: string) => void;
}

VidtreoRecorderState

interface VidtreoRecorderState {
  recordingState: RecordingState;
  stream: MediaStream | null;
  isMuted: boolean;
  isPaused: boolean;
  error: string | null;
  countdown: number | null;
  timer: string;
  uploadProgress: number | null;
  transitionMessage: string | null;
  isInitialized: boolean;
  recordedBlob: Blob | null;
  devices: {
    cameras: MediaDeviceInfo[];
    microphones: MediaDeviceInfo[];
    selectedCamera: string | null;
    selectedMic: string | null;
  };
}

VidtreoRecorderActions

interface VidtreoRecorderActions {
  startRecording(sourceType?: SourceType): Promise<void>;
  stopRecording(): Promise<RecordingStopResult>;
  pauseRecording(): void;
  resumeRecording(): void;
  toggleMute(): void;
  switchSource(sourceType: SourceType): Promise<void>;
  changeCamera(deviceId: string): Promise<void>;
  changeMic(deviceId: string): Promise<void>;
  startPreview(sourceType?: SourceType): Promise<void>;
  mark(marker: RecordingMarkerInput): void;
  downloadVideo(): void;
  cleanup(): void;
}

VidtreoRecorderHandle

The ref of the React <VidtreoRecorder> component. The Vue component exposes the same shape as VidtreoRecorderExposed.

interface VidtreoRecorderHandle {
  mark(marker: RecordingMarkerInput): void;
}

See Recording Markers.

Translation Types

type TranslationKeys =
  | 'initializingCamera'
  | 'grantPermissions'
  | 'switchingDevice'
  | 'recordingStartsIn'
  | 'switchingSource'
  | 'rec'
  | 'settings'
  | 'record'
  | 'stop'
  | 'pause'
  | 'resume'
  | 'mute'
  | 'unmute'
  | 'switchSource'
  | 'camera'
  | 'microphone'
  | 'uploading';

type PartialTranslations = Partial<Record<TranslationKeys, string>>;

Callback Types

UploadCompleteResult

interface UploadCompleteResult {
  uploadUrl: string;
  recordingId: string;
}

RecordingCallbacks

interface RecordingCallbacks {
  onStateChange: (state: RecordingState) => void;
  onCountdownUpdate: (state: RecordingState, remaining: number) => void;
  onTimerUpdate: (formatted: string) => void;
  onError: (error: Error) => void;
  onRecordingComplete: (blob: Blob) => void;
  onGetConfig: () => Promise<TranscodeConfig>;
}

UploadCallbacks

interface UploadCallbacks {
  onProgress: (progress: number) => void;
  onSuccess: (result: UploadCompleteResult) => void;
  onError: (error: Error) => void;
  onClearStatus: () => void;
}

Importing Types

// From core SDK
import type {
  VidtreoRecorderConfig,
  RecordingState,
  SourceType,
  RecordingStopResult,
  RecordingMarkerInput,
  RecordingMarker,
  IntegrityOptions,
  IntegrityReport,
  IntegritySignal,
  AvailableDevices,
  RecordingStartOptions,
  TranscodeConfig,
} from '@vidtreo/recorder';

// From React package
import type {
  VidtreoRecorderProps,
  VidtreoRecorderState,
  VidtreoRecorderActions,
  UseVidtreoRecorderConfig,
  UseVidtreoRecorderReturn,
  PartialTranslations,
  TranslationKeys,
} from '@vidtreo/recorder-react';

On this page