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
}

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;
}

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;
}

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>;
  downloadVideo(): void;
  cleanup(): void;
}

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,
  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