TypeScript reference
Import these eight runtime values from the package root. Internal source paths and the native HybridObject interface are not public entry points.
Runtime export | Contract |
|---|---|
| Returns |
| Returns |
| Returns a |
| Returns |
| Returns |
| Returns |
| React hook with its own compression session, progress, result, error, cancellation, and reset. |
| Frozen |
The ten public type exports are CompressOptions, QualityPreset, VideoCodec, VideoMetadata, ThumbnailOptions, ThumbnailResult, VideoCompressor, BatchInput, BatchOptions, and BatchProgress.
These are reference shapes for those exports. CompressOptions is flattened for readability; its public fields are unchanged. Import the types from the package rather than copying the declarations.
export type QualityPreset = "low" | "medium" | "high";
export type VideoCodec = "h264" | "hevc";
export interface CompressOptions {
/** Preset defaults; explicit defined options override preset fields. */
quality?: QualityPreset;
maxWidth?: number;
maxHeight?: number;
bitrate?: number;
codec?: VideoCodec;
/** Maximum output frame rate; frames are dropped, never duplicated. */
maxFrameRate?: number;
startTime?: number;
endTime?: number;
mute?: boolean;
audioBitrate?: number;
audioSampleRate?: number;
audioChannels?: number;
outputFileName?: string;
overwrite?: boolean;
/** Progress notification interval in milliseconds. Default: 300. */
progressInterval?: number;
optimizeForNetworkUse?: boolean;
}
export interface VideoMetadata {
/** Displayed dimensions, accounting for rotation. */
width: number;
height: number;
duration: number;
/** Bytes, or 0 when unavailable for an Android content URI. */
size: number;
bitrate: number;
frameRate: number;
hasAudio: boolean;
rotation: number;
}
export interface ThumbnailOptions {
/** Seconds from the beginning of the input. Default: 0. */
time?: number;
maxWidth?: number;
maxHeight?: number;
/** JPEG quality from 0 to 1. Default: 0.8. */
quality?: number;
outputFileName?: string;
overwrite?: boolean;
}
export interface ThumbnailResult {
path: string;
width: number;
height: number;
}
export interface VideoCompressor {
compress(
inputUri: string,
options?: CompressOptions,
onProgress?: (progress: number) => void,
): Promise<string>;
cancel(): Promise<void>;
}
export interface BatchInput {
inputUri: string;
options?: CompressOptions;
}
export interface BatchProgress {
index: number;
total: number;
itemProgress: number;
progress: number;
}
export interface BatchOptions {
signal?: AbortSignal;
onProgress?: (event: BatchProgress) => void;
}NativeCompressOptions and MediaTransformer are internal native bridge declarations, not root imports. The hook has no named public result type; use ReturnType<typeof useVideoCompressor> in your app.