@onamfc/video-transcoder
Version:
Backend-agnostic video recording and transcoding module with AWS integration
112 lines • 2.69 kB
TypeScript
export interface RecorderConfig {
apiEndpoint: string;
authHeaders?: Record<string, string>;
maxDuration?: number;
videoQuality?: 'low' | 'medium' | 'high' | 'auto';
audioEnabled?: boolean;
chunkSize?: number;
maxRetries?: number;
parallelUploads?: number;
pollingIntervalMs?: number;
outputFormats?: ('hls' | 'mp4' | 'webm')[];
thumbnailCount?: number;
showPreview?: boolean;
previewElement?: HTMLVideoElement;
customStyles?: Partial<CSSStyleDeclaration>;
}
export interface RecordingResult {
blob: Blob;
duration: number;
size: number;
mimeType: string;
}
export interface UploadResult {
trackingId: string;
uploadUrl: string;
expiresAt: string;
}
export interface ProgressEvent {
trackingId: string;
type: 'upload' | 'processing';
progress: number;
bytesUploaded?: number;
totalBytes?: number;
stage?: string;
}
export interface ProcessingResult {
trackingId: string;
status: 'completed' | 'failed' | 'processing';
hlsUrl?: string;
mp4Url?: string;
webmUrl?: string;
thumbnails?: string[];
duration?: number;
error?: string;
}
export interface ErrorEvent {
trackingId?: string;
type: 'recording' | 'upload' | 'processing' | 'network';
message: string;
code?: string;
retryable: boolean;
}
export interface StatusResult {
trackingId: string;
status: 'uploading' | 'processing' | 'completed' | 'failed';
progress: number;
createdAt: string;
completedAt?: string;
urls?: {
hls?: string;
mp4?: string;
webm?: string;
};
thumbnails?: string[];
error?: string;
}
export interface RecordingList {
recordings: StatusResult[];
total: number;
page: number;
hasMore: boolean;
}
export interface MediaConstraints {
video: {
width: {
ideal: number;
max: number;
};
height: {
ideal: number;
max: number;
};
frameRate: {
ideal: number;
max: number;
};
facingMode?: 'user' | 'environment';
};
audio: boolean | MediaTrackConstraints;
}
export interface ChunkUploadInfo {
chunkIndex: number;
totalChunks: number;
chunkSize: number;
uploadUrl: string;
etag?: string;
}
export interface MultipartUploadInfo {
uploadId: string;
key: string;
chunks: ChunkUploadInfo[];
}
export interface ErrorTracker {
captureException: (error: unknown, context?: unknown) => void;
}
declare global {
interface Window {
errorTracker?: ErrorTracker;
}
}
export {};
//# sourceMappingURL=index.d.ts.map