dasha 4.0.0-alpha.9 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dasha.d.mts DELETED
@@ -1,392 +0,0 @@
1
- //#region lib/shared/codec.d.ts
2
- /**
3
- * List of known video codecs, ordered by encoding preference.
4
- * @group Codecs
5
- * @public
6
- */
7
- declare const VIDEO_CODECS: readonly ["avc", "hevc", "vp8", "vp9", "av1", "vc1"];
8
- /**
9
- * List of known video dynamic ranges.
10
- * @group Codecs
11
- * @public
12
- */
13
- declare const VIDEO_DYNAMIC_RANGES: readonly ["sdr", "hlg", "hdr10", "hdr10+", "dv"];
14
- /**
15
- * List of known audio codecs, ordered by encoding preference.
16
- * @group Codecs
17
- * @public
18
- */
19
- declare const AUDIO_CODECS: readonly ["aac", "opus", "mp3", "vorbis", "flac", "alac", "ac3", "eac3", "dts"];
20
- /**
21
- * List of known subtitle codecs, ordered by encoding preference.
22
- * @group Codecs
23
- * @public
24
- */
25
- declare const SUBTITLE_CODECS: readonly ["srt", "vtt", "ttml", "dfxp", "ssa", "ass", "stpp", "wvtt"];
26
- /**
27
- * Union type of known video codecs.
28
- * @group Codecs
29
- * @public
30
- */
31
- type VideoCodec = (typeof VIDEO_CODECS)[number];
32
- /**
33
- * Union type of known video dynamic ranges.
34
- * @group Codecs
35
- * @public
36
- */
37
- type VideoDynamicRange = (typeof VIDEO_DYNAMIC_RANGES)[number];
38
- /**
39
- * Union type of known audio codecs.
40
- * @group Codecs
41
- * @public
42
- */
43
- type AudioCodec = (typeof AUDIO_CODECS)[number];
44
- /**
45
- * Union type of known subtitle codecs.
46
- * @group Codecs
47
- * @public
48
- */
49
- type SubtitleCodec = (typeof SUBTITLE_CODECS)[number];
50
- /**
51
- * Union type of known media codecs.
52
- * @group Codecs
53
- * @public
54
- */
55
- type MediaCodec = VideoCodec | AudioCodec | SubtitleCodec;
56
- //#endregion
57
- //#region lib/shared/encrypt-method.d.ts
58
- declare const ENCRYPT_METHODS: {
59
- readonly NONE: "none";
60
- readonly AES_128: "aes-128";
61
- readonly AES_128_ECB: "aes-128-ecb";
62
- readonly SAMPLE_AES: "sample-aes";
63
- readonly SAMPLE_AES_CTR: "sample-aes-ctr";
64
- readonly CENC: "cenc";
65
- readonly CHACHA20: "chacha20";
66
- readonly UNKNOWN: "unknown";
67
- };
68
- type EncryptMethod = (typeof ENCRYPT_METHODS)[keyof typeof ENCRYPT_METHODS];
69
- //#endregion
70
- //#region lib/shared/encrypt-info.d.ts
71
- type DrmType = 'widevine' | 'playready' | 'fairplay';
72
- declare class EncryptInfo {
73
- method: EncryptMethod;
74
- key?: Uint8Array;
75
- iv?: Uint8Array;
76
- drm: { [key in DrmType]?: {
77
- keyId?: string;
78
- pssh?: string;
79
- } };
80
- constructor(method?: string | null);
81
- parseMethod(method?: string | null): EncryptMethod;
82
- }
83
- //#endregion
84
- //#region lib/shared/extractor-type.d.ts
85
- declare const EXTRACTOR_TYPES: {
86
- readonly MPEG_DASH: "MPEG_DASH";
87
- readonly HLS: "HLS";
88
- readonly HTTP_LIVE: "HTTP_LIVE";
89
- readonly MSS: "MSS";
90
- };
91
- type ExtractorType = (typeof EXTRACTOR_TYPES)[keyof typeof EXTRACTOR_TYPES];
92
- //#endregion
93
- //#region lib/shared/media-segment.d.ts
94
- declare class MediaSegment {
95
- index: number;
96
- duration: number;
97
- title?: string;
98
- dateTime?: Date;
99
- startRange?: number;
100
- get stopRange(): number | undefined;
101
- expectLength?: number;
102
- encryptInfo: EncryptInfo;
103
- get isEncrypted(): boolean;
104
- url: string;
105
- nameFromVar?: string;
106
- equals(segment: unknown): boolean;
107
- getHashCode(): string;
108
- }
109
- //#endregion
110
- //#region lib/shared/media-part.d.ts
111
- declare class MediaPart {
112
- mediaSegments: MediaSegment[];
113
- constructor(segments?: MediaSegment[]);
114
- }
115
- //#endregion
116
- //#region lib/shared/playlist.d.ts
117
- declare class Playlist {
118
- url: string;
119
- isLive: boolean;
120
- refreshIntervalMs: number;
121
- get totalDuration(): number;
122
- targetDuration?: number;
123
- mediaInit?: MediaSegment;
124
- mediaParts: MediaPart[];
125
- }
126
- //#endregion
127
- //#region lib/shared/role-type.d.ts
128
- declare const ROLE_TYPE: {
129
- Subtitle: number;
130
- Main: number;
131
- Alternate: number;
132
- Supplementary: number;
133
- Commentary: number;
134
- Dub: number;
135
- Description: number;
136
- Sign: number;
137
- Metadata: number;
138
- ForcedSubtitle: number;
139
- };
140
- type RoleType = (typeof ROLE_TYPE)[keyof typeof ROLE_TYPE];
141
- //#endregion
142
- //#region lib/shared/stream-info.d.ts
143
- /**
144
- * List of all stream types.
145
- * @group Miscellaneous
146
- * @public
147
- */
148
- declare const ALL_STREAM_TYPES: readonly ["video", "audio", "subtitle"];
149
- /**
150
- * Union type of all stream types.
151
- * @group Miscellaneous
152
- * @public
153
- */
154
- type StreamType = (typeof ALL_STREAM_TYPES)[number];
155
- declare abstract class StreamInfo {
156
- abstract get type(): StreamType | undefined;
157
- codec?: MediaCodec;
158
- languageCode?: string;
159
- bitrate?: number;
160
- name?: string;
161
- url: string;
162
- originalUrl: string;
163
- playlist?: Playlist;
164
- default?: boolean;
165
- skippedDuration?: number;
166
- role?: RoleType;
167
- videoRange?: string;
168
- characteristics?: string;
169
- publishTime?: Date;
170
- groupId: string | null;
171
- audioId?: string;
172
- videoId?: string;
173
- subtitleId?: string;
174
- periodId: string | null;
175
- extension: string | null;
176
- /**
177
- * @deprecated Use `codec`
178
- */
179
- codecs: string | null;
180
- /**
181
- * @deprecated Use `numberOfChannels` in `AudioStreamInfo`
182
- */
183
- channels: string | null;
184
- /**
185
- * @deprecated Use `width` and `height` in `VideoStreamInfo`
186
- */
187
- resolution?: string;
188
- /**
189
- * @deprecated Use `bitrate`
190
- */
191
- bandwidth?: number;
192
- get segmentsCount(): number;
193
- }
194
- declare class VideoStreamInfo extends StreamInfo {
195
- codec?: VideoCodec;
196
- width?: number;
197
- height?: number;
198
- frameRate?: number;
199
- dynamicRange?: VideoDynamicRange;
200
- dolbyVisionProfile?: 'P5' | 'P7' | 'P8' | string;
201
- get type(): "video";
202
- constructor(info?: Partial<VideoStreamInfo>);
203
- toShortString(): string;
204
- }
205
- declare class AudioStreamInfo extends StreamInfo {
206
- codec?: AudioCodec;
207
- numberOfChannels?: number;
208
- sampleRate?: number;
209
- atmos?: boolean;
210
- descriptive?: boolean;
211
- joc?: number;
212
- get type(): "audio";
213
- constructor(info?: Partial<AudioStreamInfo>);
214
- toShortString(): string;
215
- }
216
- declare class SubtitleStreamInfo extends StreamInfo {
217
- codec?: SubtitleCodec;
218
- cc?: boolean;
219
- sdh?: boolean;
220
- forced?: boolean;
221
- get type(): "subtitle";
222
- constructor(info?: Partial<SubtitleStreamInfo>);
223
- toShortString(): string;
224
- }
225
- type MediaStreamInfo = VideoStreamInfo | AudioStreamInfo | SubtitleStreamInfo;
226
- //#endregion
227
- //#region lib/extractor.d.ts
228
- interface Extractor {
229
- extractorType: ExtractorType;
230
- extractStreams(rawText: string): Promise<MediaStreamInfo[]>;
231
- fetchPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
232
- refreshPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
233
- preProcessUrl(url: string): string;
234
- preProcessContent(): void;
235
- }
236
- //#endregion
237
- //#region lib/processor.d.ts
238
- interface ContentProcessor {
239
- canProcess(extractorType: ExtractorType, rawText: string, parserConfig: ParserConfig): boolean;
240
- process(rawText: string, parserConfig: ParserConfig): string;
241
- }
242
- interface KeyProcessor {
243
- canProcess(extractorType: ExtractorType, keyLine: string, m3u8Url: string, m3u8Content: string, parserConfig: ParserConfig): boolean;
244
- process(keyLine: string, m3u8Url: string, m3u8Content: string, parserConfig: ParserConfig): Promise<EncryptInfo>;
245
- }
246
- interface UrlProcessor {
247
- canProcess(extractorType: ExtractorType, originalUrl: string, parserConfig: ParserConfig): boolean;
248
- process(originalUrl: string, parserConfig: ParserConfig): string;
249
- }
250
- declare class DefaultUrlProcessor implements UrlProcessor {
251
- canProcess(_extractorType: ExtractorType, _originalUrl: string, parserConfig: ParserConfig): boolean;
252
- process(url: string, parserConfig: ParserConfig): string;
253
- }
254
- //#endregion
255
- //#region lib/parser-config.d.ts
256
- declare class ParserConfig {
257
- url: string;
258
- originalUrl: string;
259
- baseUrl?: string;
260
- customParserArgs: Record<string, string>;
261
- headers: Record<string, string>;
262
- contentProcessors: ContentProcessor[];
263
- urlProcessors: UrlProcessor[];
264
- keyProcessors: KeyProcessor[];
265
- customMethod?: EncryptMethod;
266
- customKey?: Uint8Array;
267
- customIv?: Uint8Array;
268
- urlProcessorArgs?: string;
269
- appendUrlParams: boolean;
270
- keyRetryCount: number;
271
- }
272
- //#endregion
273
- //#region lib/stream-extractor.d.ts
274
- declare class StreamExtractor {
275
- #private;
276
- constructor(parserConfig?: ParserConfig);
277
- get extractorType(): ExtractorType;
278
- loadSourceFromUrl(url: string): Promise<void>;
279
- loadSourceFromText(rawText: string, url?: string): void;
280
- extractStreams(): Promise<MediaStreamInfo[]>;
281
- fetchPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
282
- refreshPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
283
- }
284
- //#endregion
285
- //#region lib/dash/dash-content-processor.d.ts
286
- declare class DefaultDashContentProcessor implements ContentProcessor {
287
- canProcess(extractorType: ExtractorType, mpdContent: string): boolean;
288
- process(mpdContent: string): string;
289
- }
290
- //#endregion
291
- //#region lib/dash/dash-extractor.d.ts
292
- declare class DashExtractor implements Extractor {
293
- #private;
294
- get extractorType(): ExtractorType;
295
- constructor(parserConfig: ParserConfig);
296
- extractStreams(rawText: string): Promise<MediaStreamInfo[]>;
297
- refreshPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
298
- fetchPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
299
- preProcessUrl(url: string): string;
300
- preProcessContent(): void;
301
- }
302
- //#endregion
303
- //#region lib/dash/dash-tags.d.ts
304
- declare const DASH_TAGS: {
305
- TemplateRepresentationID: string;
306
- TemplateBandwidth: string;
307
- TemplateNumber: string;
308
- TemplateTime: string;
309
- };
310
- //#endregion
311
- //#region lib/dash/dash-utils.d.ts
312
- /**
313
- * Extracts StartRange and ExpectLength information from a string like "100-300"
314
- * @param range - The range string in the format "start-end"
315
- * @returns A tuple containing [StartRange, ExpectLength]
316
- */
317
- declare const parseRange: (range: string) => [number, number];
318
- //#endregion
319
- //#region lib/hls/hls-content-processor.d.ts
320
- declare class DefaultHlsContentProcessor implements ContentProcessor {
321
- private static readonly YkDVRegex;
322
- private static readonly DNSPRegex;
323
- private static readonly DNSPSubRegex;
324
- private static readonly OrderFixRegex;
325
- private static readonly ATVRegex;
326
- private static readonly ATVRegex2;
327
- canProcess(extractorType: ExtractorType): boolean;
328
- process(m3u8Content: string, parserConfig: ParserConfig): string;
329
- private applyRegexReplacement;
330
- }
331
- //#endregion
332
- //#region lib/hls/hls-extractor.d.ts
333
- declare class HlsExtractor implements Extractor {
334
- #private;
335
- get extractorType(): ExtractorType;
336
- parserConfig: ParserConfig;
337
- constructor(parserConfig: ParserConfig);
338
- preProcessContent(): void;
339
- preProcessUrl(url: string): string;
340
- extractStreams(rawText: string): Promise<MediaStreamInfo[]>;
341
- fetchPlayList(lists: MediaStreamInfo[]): Promise<void>;
342
- refreshPlayList(streamInfos: MediaStreamInfo[]): Promise<void>;
343
- }
344
- //#endregion
345
- //#region lib/hls/hls-key-processor.d.ts
346
- declare class DefaultHlsKeyProcessor implements KeyProcessor {
347
- canProcess(extractorType: ExtractorType): boolean;
348
- process(keyLine: string, m3u8Url: string, _m3u8Content: string, parserConfig: ParserConfig): Promise<EncryptInfo>;
349
- private getAttribute;
350
- private fetchKeyWithRetry;
351
- private preProcessUrl;
352
- }
353
- //#endregion
354
- //#region lib/hls/hls-tags.d.ts
355
- declare const HLS_TAGS: {
356
- extM3u: string;
357
- extXTargetDuration: string;
358
- extXMediaSequence: string;
359
- extXDiscontinuitySequence: string;
360
- extXProgramDateTime: string;
361
- extXMedia: string;
362
- extXPlaylistType: string;
363
- extXKey: string;
364
- extXStreamInf: string;
365
- extXVersion: string;
366
- extXAllowCache: string;
367
- extXEndlist: string;
368
- extInf: string;
369
- extIframesOnly: string;
370
- extXByterange: string;
371
- extXIframeStreamInf: string;
372
- extXDiscontinuity: string;
373
- extXCueOutStart: string;
374
- extXCueOut: string;
375
- extIsIndependentSegments: string;
376
- extXScte35: string;
377
- extXCueStart: string;
378
- extXCueEnd: string;
379
- extXCueSpan: string;
380
- extXMap: string;
381
- extXStart: string;
382
- };
383
- //#endregion
384
- //#region lib/hls/hls-utils.d.ts
385
- /**
386
- * Extracts length and optional start values from a string formatted as "n[@o]".
387
- * @param input - The input string.
388
- * @returns A tuple containing [n (length), o (start)].
389
- */
390
- declare function getRange(input: string): [number, number | null];
391
- //#endregion
392
- export { ALL_STREAM_TYPES, AUDIO_CODECS, AudioCodec, AudioStreamInfo, ContentProcessor, DASH_TAGS, DashExtractor, DefaultDashContentProcessor, DefaultHlsContentProcessor, DefaultHlsKeyProcessor, DefaultUrlProcessor, ENCRYPT_METHODS, EXTRACTOR_TYPES, EncryptInfo, EncryptMethod, Extractor, ExtractorType, HLS_TAGS, HlsExtractor, KeyProcessor, MediaCodec, MediaPart, MediaSegment, MediaStreamInfo, ParserConfig, Playlist, ROLE_TYPE, RoleType, SUBTITLE_CODECS, StreamExtractor, StreamInfo, StreamType, SubtitleCodec, SubtitleStreamInfo, UrlProcessor, VIDEO_CODECS, VIDEO_DYNAMIC_RANGES, VideoCodec, VideoDynamicRange, VideoStreamInfo, getRange, parseRange };