UNPKG

parse-hls

Version:

Parse HLS Manifests with zero dependencies

50 lines (49 loc) 1.51 kB
declare type AttributeValue = string | number | boolean | string[] | number[] | Date | null; interface Attributes { [key: string]: AttributeValue; } declare type LineType = "TAG" | "URI"; export declare class Item { readonly uri: string; readonly properties: M3ULine[]; constructor(uri: string, properties: M3ULine[]); serialize(): any; } export declare class M3ULine { type: LineType; tagName: string | null; name: string | null; attributes: Attributes; content: string; constructor(line: string); serialize(): any; getAttribute(key: string): AttributeValue; setAttribute(key: string, value: AttributeValue): M3ULine; getUri(): string; } export default class HLS { static parse(content: string): HLS; readonly lines: M3ULine[]; readonly segments: Item[]; readonly streamRenditions: Item[]; readonly iFrameRenditions: Item[]; readonly imageRenditions: Item[]; readonly audioRenditions: Item[]; readonly alternateVideoRenditions: Item[]; readonly subtitlesRenditions: Item[]; readonly closedCaptionsRenditions: Item[]; readonly isMaster: boolean; readonly isLive: boolean; readonly totalDuration: number; get type(): "master" | "live" | "vod"; get manifestProperties(): { [key: string]: any; }; private constructor(); findAll(tag: string): M3ULine[]; find(tag: string): M3ULine; serialize(): any; private getStreamItems; private accumulateItems; } export {};