Skip to content

API

export { MediaPipelineSDK } from "./core/pipeline";
export { HLS_PROFILES } from "./utils/hlsProfiles";
export { VIDEO_RESOLUTIONS } from "./utils/resolutions";
export * from "./types/media.types";
export { validateConfig } from "./core/config";

new MediaPipelineSDK(config, resolutions, isCleanTheOriginalFileFromLocalPath?)

Section titled “new MediaPipelineSDK(config, resolutions, isCleanTheOriginalFileFromLocalPath?)”

Creates a pipeline instance.

  • config: A PipelineConfig object.
  • resolutions: Array of target resolution keys like "1080", "720", "480", or "360".
  • isCleanTheOriginalFileFromLocalPath: Optional cleanup flag for source and generated local files.

Generate HLS assets locally.

An object that includes the processing result and the generated output directory.

{
type: "video",
variants: [{ name: "hls", path: "output/<uuid>/master.m3u8" }],
outputDir: "output/<uuid>",
}

Generate HLS assets locally, upload the HLS package to Cloudinary, and return the master playlist URL.

string;

Generate HLS assets locally, upload playlists and segments to S3, create signed playlist variants under signed/, and return a signed playback URL.

string;

Validates that the storage configuration exists and that the current SDK version is only using supported storage types.

type MediaType = "video" | "image";
type StorageType =
| "local"
| "s3"
| "gcs"
| "azure"
| "cloudflare"
| "cloudinary";
type VideoResolution = "1080" | "720" | "480" | "360";
interface MediaVariant {
name: string;
path: string;
}
interface ProcessResult {
type: MediaType;
variants: MediaVariant[];
}
interface CloudinaryCredentials {
cloudName: string;
apiKey: string;
apiSecret: string;
}
interface S3Credentials {
accessKeyId: string;
secretAccessKey: string;
region: string;
bucket: string;
folderName: string;
}
interface PipelineConfig {
storage: {
type: StorageType;
baseDir: string;
credentials?: CloudinaryCredentials | S3Credentials;
};
}