@adonis-agora/media
Version:
Media-library for AdonisJS — owner collections (MIME whitelist, single-file replace, ordering), image conversions (eager/lazy), pluggable content transformers (HLS video via mediabunny, metadata probe, image blur-up placeholder), and column attachments, a
51 lines • 2.03 kB
TypeScript
/**
* Describe CMAF HLS media playlists as a DASH manifest — how a package muxed by an engine that
* only writes HLS (mediabunny) also plays over DASH. The segments are the same files; only the
* description changes, so this is text in, text out.
*/
/** One media segment of a playlist. */
export interface PlaylistSegment {
uri: string;
/** Seconds (`#EXTINF`). */
duration: number;
}
/** What a media playlist says about its segments. */
export interface ParsedMediaPlaylist {
/** `#EXT-X-MAP` init section, when the segments are fragmented MP4. */
init?: string;
segments: PlaylistSegment[];
}
/** One `#EXT-X-STREAM-INF` of a master playlist. */
export interface ParsedVariant {
uri: string;
bandwidth?: number;
codecs?: string;
width?: number;
height?: number;
}
/** Read the segments (and init section) of an HLS media playlist. */
export declare function parseMediaPlaylist(content: string): ParsedMediaPlaylist;
/** Read the variants of an HLS master playlist. */
export declare function parseMasterPlaylist(content: string): ParsedVariant[];
/** One track of the DASH manifest: a media playlist, re-described. */
export interface DashRepresentationInput {
type: 'video' | 'audio';
/** Package-relative path prefix of the playlist's files (`'video/'`), prepended to its URIs. */
base: string;
playlist: ParsedMediaPlaylist;
codecs?: string | undefined;
bandwidth?: number | undefined;
width?: number | undefined;
height?: number | undefined;
}
/**
* Build a static DASH manifest (`SegmentList` + `SegmentTimeline`, one adaptation set per track
* type) over the segments of CMAF media playlists. Durations go through a millisecond timeline
* computed from the running total, so rounding never drifts across a long video.
*/
export declare function buildDashManifest(input: {
durationSeconds: number;
targetDuration: number;
representations: readonly DashRepresentationInput[];
}): string;
//# sourceMappingURL=to_dash.d.ts.map