m3u8parse
Version:
Structural parsing of Apple HTTP Live Streaming .m3u8 format
49 lines (48 loc) • 2.75 kB
TypeScript
import type * as AttrT from './attr-types.js';
import { AttrList, Byterange } from './attrlist.js';
import { IRewritableUris, UriMapFunction } from './playlist-base.js';
import type { Proto } from './types.js';
export declare class MediaSegment implements IRewritableUris {
uri?: string;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.1 `#EXTINF`} */
duration?: number;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.1 `#EXTINF`} */
title?: string;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.3 `#EXT-X-DISCONTINUITY`} */
discontinuity: boolean;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.6 `#EXT-X-PROGRAM-DATE-TIME`} */
program_time?: Date | null;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.4 `#EXT-X-KEY`} */
keys?: AttrList<AttrT.Key>[];
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.2 `#EXT-X-BYTERANGE`} */
byterange?: Byterange;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.5 `#EXT-X-MAP`} */
map?: AttrList<AttrT.Map>;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.7 `#EXT-X-GAP`} */
gap?: boolean;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.8 `#EXT-X-BITRATE`} */
bitrate?: number;
/** @see {@link https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-16#section-4.4.4.9 `#EXT-X-PART`} */
parts?: AttrList<AttrT.Part>[];
/** Custom vendor-defined properties */
vendor?: Iterable<[string, string | null]>;
constructor(obj?: Proto<MediaSegment>);
constructor(uri: string | typeof URL | undefined, meta: Readonly<MediaSegment>, version?: number);
constructor(uri: string | typeof URL | undefined, meta: Proto<MediaSegment>, version?: number);
isPartial(): this is PartialSegment;
rewriteUris(mapFn: UriMapFunction<'segment' | 'segment-key' | 'segment-map' | 'segment-part'>): this;
}
interface FullSegment extends Readonly<MediaSegment> {
duration: number;
title: string;
uri: string;
}
interface PartialSegment extends Readonly<MediaSegment> {
/** Only used for TS typings. @internal @deprecated */
readonly __isPartial__: undefined;
}
export type ImmutableMediaSegment = PartialSegment | FullSegment;
export type IndependentSegment = ImmutableMediaSegment & {
byterange?: Required<Byterange>;
};
export {};