newpipe-extractor-js
Version:
JavaScript/Node.js port of NewPipeExtractor
110 lines • 2.7 kB
TypeScript
import { AudioStream, VideoStream, Range } from '../../types';
export interface DashManifest {
audioStreams: AudioStream[];
videoStreams: VideoStream[];
videoOnlyStreams: VideoStream[];
duration?: number;
isLive: boolean;
}
export interface DashRepresentation {
id: string;
bandwidth: number;
codecs?: string;
mimeType: string;
width?: number;
height?: number;
frameRate?: string;
audioSamplingRate?: number;
baseUrl?: string;
initRange?: Range;
indexRange?: Range;
segmentTemplate?: DashSegmentTemplate;
}
export interface DashSegmentTemplate {
initialization?: string;
media?: string;
startNumber?: number;
timescale?: number;
duration?: number;
}
export interface DashAdaptationSet {
id?: string;
mimeType: string;
codecs?: string;
contentType: 'audio' | 'video';
lang?: string;
representations: DashRepresentation[];
segmentTemplate?: DashSegmentTemplate;
}
export declare class DashManifestParser {
constructor();
/**
* Parse DASH MPD manifest from XML string
*/
parseDashManifest(mpdContent: string): Promise<DashManifest>;
/**
* Parse a Period element
*/
private parsePeriod;
/**
* Parse an AdaptationSet element
*/
private parseAdaptationSet;
/**
* Parse a Representation element
*/
private parseRepresentation;
/**
* Parse SegmentTemplate element
*/
private parseSegmentTemplate;
/**
* Convert DASH adaptation set to stream objects
*/
private convertAdaptationSetToStreams;
/**
* Create stream object from DASH representation
*/
private createStreamFromRepresentation;
/**
* Determine content type from MIME type
*/
private getContentType;
/**
* Convert MIME type to MediaFormat
*/
private getMediaFormat;
/**
* Check if manifest represents live content
*/
private isLiveManifest;
/**
* Check if MIME type represents video-only content
*/
private isVideoOnly;
/**
* Parse range string (e.g., "0-1234")
*/
private parseRange;
/**
* Parse duration string (ISO 8601 format: PT1H2M3S)
*/
private parseDuration;
/**
* Parse integer attribute with fallback
*/
private parseIntAttribute;
/**
* Extract itag from representation ID if possible
*/
private extractItag;
/**
* Get audio quality description from bitrate
*/
private getAudioQuality;
/**
* Get video quality description from resolution
*/
private getVideoQuality;
}
//# sourceMappingURL=DashManifestParser.d.ts.map