@remotion/media-parser 4.0.385 → 4.0.387
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/containers/m3u/after-manifest-fetch.js +6 -5
- package/dist/containers/m3u/get-playlist.js +11 -0
- package/dist/containers/m3u/parse-directive.js +12 -0
- package/dist/containers/m3u/types.d.ts +5 -1
- package/dist/esm/index.mjs +21 -6
- package/dist/esm/worker-server-entry.mjs +20 -5
- package/dist/esm/worker-web-entry.mjs +20 -5
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -7,7 +7,12 @@ const get_streams_1 = require("./get-streams");
|
|
|
7
7
|
const select_stream_1 = require("./select-stream");
|
|
8
8
|
const afterManifestFetch = async ({ structure, m3uState, src, selectM3uStreamFn, logLevel, selectAssociatedPlaylistsFn, readerInterface, onAudioTrack, canSkipTracks, }) => {
|
|
9
9
|
const independentSegments = (0, get_streams_1.isIndependentSegments)(structure);
|
|
10
|
-
|
|
10
|
+
const streams = (0, get_streams_1.getM3uStreams)({ structure, originalSrc: src, readerInterface });
|
|
11
|
+
// Handle single media playlists (not master playlists):
|
|
12
|
+
// 1. If !independentSegments: Old-style single playlist without segment independence
|
|
13
|
+
// 2. If streams === null: Single media playlist (has EXT-X-INDEPENDENT-SEGMENTS but no EXT-X-STREAM-INF)
|
|
14
|
+
// Both cases should iterate over the current URL as the media playlist
|
|
15
|
+
if (!independentSegments || streams === null) {
|
|
11
16
|
if (!src) {
|
|
12
17
|
throw new Error('No src');
|
|
13
18
|
}
|
|
@@ -17,10 +22,6 @@ const afterManifestFetch = async ({ structure, m3uState, src, selectM3uStreamFn,
|
|
|
17
22
|
});
|
|
18
23
|
return m3uState.setReadyToIterateOverM3u();
|
|
19
24
|
}
|
|
20
|
-
const streams = (0, get_streams_1.getM3uStreams)({ structure, originalSrc: src, readerInterface });
|
|
21
|
-
if (streams === null) {
|
|
22
|
-
throw new Error('No streams found');
|
|
23
|
-
}
|
|
24
25
|
const selectedPlaylist = await (0, select_stream_1.selectStream)({ streams, fn: selectM3uStreamFn });
|
|
25
26
|
if (!selectedPlaylist.dimensions) {
|
|
26
27
|
throw new Error('Stream does not have a resolution');
|
|
@@ -14,6 +14,17 @@ const getAllPlaylists = ({ structure, src, }) => {
|
|
|
14
14
|
];
|
|
15
15
|
}
|
|
16
16
|
const playlists = structure.boxes.filter((box) => box.type === 'm3u-playlist');
|
|
17
|
+
// If no playlists found, this might be a single media playlist (not a master playlist)
|
|
18
|
+
// Create a synthetic playlist from the structure boxes
|
|
19
|
+
if (playlists.length === 0) {
|
|
20
|
+
return [
|
|
21
|
+
{
|
|
22
|
+
type: 'm3u-playlist',
|
|
23
|
+
boxes: structure.boxes,
|
|
24
|
+
src,
|
|
25
|
+
},
|
|
26
|
+
];
|
|
27
|
+
}
|
|
17
28
|
return playlists;
|
|
18
29
|
};
|
|
19
30
|
exports.getAllPlaylists = getAllPlaylists;
|
|
@@ -112,6 +112,18 @@ const parseM3uDirective = (str) => {
|
|
|
112
112
|
value: p.URI,
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
|
+
if (directive === '#EXT-X-PROGRAM-DATE-TIME') {
|
|
116
|
+
if (!value) {
|
|
117
|
+
throw new Error('#EXT-X-PROGRAM-DATE-TIME directive must have a value');
|
|
118
|
+
}
|
|
119
|
+
// Store the raw ISO 8601 date-time string without validation.
|
|
120
|
+
// This directive associates media segments with absolute dates but
|
|
121
|
+
// doesn't affect parsing of tracks, dimensions, or other metadata.
|
|
122
|
+
return {
|
|
123
|
+
type: 'm3u-program-date-time',
|
|
124
|
+
dateTime: value,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
115
127
|
throw new Error(`Unknown directive ${directive}. Value: ${value}`);
|
|
116
128
|
};
|
|
117
129
|
exports.parseM3uDirective = parseM3uDirective;
|
|
@@ -77,7 +77,11 @@ export type M3uAllowCache = {
|
|
|
77
77
|
type: 'm3u-allow-cache';
|
|
78
78
|
allowsCache: boolean;
|
|
79
79
|
};
|
|
80
|
-
export type
|
|
80
|
+
export type M3uProgramDateTime = {
|
|
81
|
+
type: 'm3u-program-date-time';
|
|
82
|
+
dateTime: string;
|
|
83
|
+
};
|
|
84
|
+
export type M3uBox = M3uHeader | M3uPlaylist | M3uVersion | M3uIndependentSegments | M3uStreamInfo | M3uTargetDuration | M3uPlaylistType | M3uExtInf | M3uMedia | M3uMediaInfo | M3uEndList | M3uMediaSequence | M3uDiscontinuitySequence | M3uMap | M3uIFrameStreamInfo | M3uTextValue | M3uAllowCache | M3uProgramDateTime;
|
|
81
85
|
export type M3uStructure = {
|
|
82
86
|
type: 'm3u';
|
|
83
87
|
boxes: M3uBox[];
|
package/dist/esm/index.mjs
CHANGED
|
@@ -7625,6 +7625,15 @@ var getAllPlaylists = ({
|
|
|
7625
7625
|
];
|
|
7626
7626
|
}
|
|
7627
7627
|
const playlists = structure.boxes.filter((box) => box.type === "m3u-playlist");
|
|
7628
|
+
if (playlists.length === 0) {
|
|
7629
|
+
return [
|
|
7630
|
+
{
|
|
7631
|
+
type: "m3u-playlist",
|
|
7632
|
+
boxes: structure.boxes,
|
|
7633
|
+
src
|
|
7634
|
+
}
|
|
7635
|
+
];
|
|
7636
|
+
}
|
|
7628
7637
|
return playlists;
|
|
7629
7638
|
};
|
|
7630
7639
|
var getPlaylist = (structure, src) => {
|
|
@@ -12206,6 +12215,15 @@ var parseM3uDirective = (str) => {
|
|
|
12206
12215
|
value: p.URI
|
|
12207
12216
|
};
|
|
12208
12217
|
}
|
|
12218
|
+
if (directive === "#EXT-X-PROGRAM-DATE-TIME") {
|
|
12219
|
+
if (!value) {
|
|
12220
|
+
throw new Error("#EXT-X-PROGRAM-DATE-TIME directive must have a value");
|
|
12221
|
+
}
|
|
12222
|
+
return {
|
|
12223
|
+
type: "m3u-program-date-time",
|
|
12224
|
+
dateTime: value
|
|
12225
|
+
};
|
|
12226
|
+
}
|
|
12209
12227
|
throw new Error(`Unknown directive ${directive}. Value: ${value}`);
|
|
12210
12228
|
};
|
|
12211
12229
|
|
|
@@ -12306,7 +12324,8 @@ var afterManifestFetch = async ({
|
|
|
12306
12324
|
canSkipTracks
|
|
12307
12325
|
}) => {
|
|
12308
12326
|
const independentSegments = isIndependentSegments(structure);
|
|
12309
|
-
|
|
12327
|
+
const streams = getM3uStreams({ structure, originalSrc: src, readerInterface });
|
|
12328
|
+
if (!independentSegments || streams === null) {
|
|
12310
12329
|
if (!src) {
|
|
12311
12330
|
throw new Error("No src");
|
|
12312
12331
|
}
|
|
@@ -12316,10 +12335,6 @@ var afterManifestFetch = async ({
|
|
|
12316
12335
|
});
|
|
12317
12336
|
return m3uState.setReadyToIterateOverM3u();
|
|
12318
12337
|
}
|
|
12319
|
-
const streams = getM3uStreams({ structure, originalSrc: src, readerInterface });
|
|
12320
|
-
if (streams === null) {
|
|
12321
|
-
throw new Error("No streams found");
|
|
12322
|
-
}
|
|
12323
12338
|
const selectedPlaylist = await selectStream({ streams, fn: selectM3uStreamFn });
|
|
12324
12339
|
if (!selectedPlaylist.dimensions) {
|
|
12325
12340
|
throw new Error("Stream does not have a resolution");
|
|
@@ -18193,7 +18208,7 @@ var downloadAndParseMedia = async (options) => {
|
|
|
18193
18208
|
return returnValue;
|
|
18194
18209
|
};
|
|
18195
18210
|
// src/version.ts
|
|
18196
|
-
var VERSION = "4.0.
|
|
18211
|
+
var VERSION = "4.0.387";
|
|
18197
18212
|
|
|
18198
18213
|
// src/index.ts
|
|
18199
18214
|
var MediaParserInternals = {
|
|
@@ -5249,6 +5249,15 @@ var getAllPlaylists = ({
|
|
|
5249
5249
|
];
|
|
5250
5250
|
}
|
|
5251
5251
|
const playlists = structure.boxes.filter((box) => box.type === "m3u-playlist");
|
|
5252
|
+
if (playlists.length === 0) {
|
|
5253
|
+
return [
|
|
5254
|
+
{
|
|
5255
|
+
type: "m3u-playlist",
|
|
5256
|
+
boxes: structure.boxes,
|
|
5257
|
+
src
|
|
5258
|
+
}
|
|
5259
|
+
];
|
|
5260
|
+
}
|
|
5252
5261
|
return playlists;
|
|
5253
5262
|
};
|
|
5254
5263
|
var getPlaylist = (structure, src) => {
|
|
@@ -12291,6 +12300,15 @@ var parseM3uDirective = (str) => {
|
|
|
12291
12300
|
value: p.URI
|
|
12292
12301
|
};
|
|
12293
12302
|
}
|
|
12303
|
+
if (directive === "#EXT-X-PROGRAM-DATE-TIME") {
|
|
12304
|
+
if (!value) {
|
|
12305
|
+
throw new Error("#EXT-X-PROGRAM-DATE-TIME directive must have a value");
|
|
12306
|
+
}
|
|
12307
|
+
return {
|
|
12308
|
+
type: "m3u-program-date-time",
|
|
12309
|
+
dateTime: value
|
|
12310
|
+
};
|
|
12311
|
+
}
|
|
12294
12312
|
throw new Error(`Unknown directive ${directive}. Value: ${value}`);
|
|
12295
12313
|
};
|
|
12296
12314
|
|
|
@@ -12342,7 +12360,8 @@ var afterManifestFetch = async ({
|
|
|
12342
12360
|
canSkipTracks
|
|
12343
12361
|
}) => {
|
|
12344
12362
|
const independentSegments = isIndependentSegments(structure);
|
|
12345
|
-
|
|
12363
|
+
const streams = getM3uStreams({ structure, originalSrc: src, readerInterface });
|
|
12364
|
+
if (!independentSegments || streams === null) {
|
|
12346
12365
|
if (!src) {
|
|
12347
12366
|
throw new Error("No src");
|
|
12348
12367
|
}
|
|
@@ -12352,10 +12371,6 @@ var afterManifestFetch = async ({
|
|
|
12352
12371
|
});
|
|
12353
12372
|
return m3uState.setReadyToIterateOverM3u();
|
|
12354
12373
|
}
|
|
12355
|
-
const streams = getM3uStreams({ structure, originalSrc: src, readerInterface });
|
|
12356
|
-
if (streams === null) {
|
|
12357
|
-
throw new Error("No streams found");
|
|
12358
|
-
}
|
|
12359
12374
|
const selectedPlaylist = await selectStream({ streams, fn: selectM3uStreamFn });
|
|
12360
12375
|
if (!selectedPlaylist.dimensions) {
|
|
12361
12376
|
throw new Error("Stream does not have a resolution");
|
|
@@ -5146,6 +5146,15 @@ var getAllPlaylists = ({
|
|
|
5146
5146
|
];
|
|
5147
5147
|
}
|
|
5148
5148
|
const playlists = structure.boxes.filter((box) => box.type === "m3u-playlist");
|
|
5149
|
+
if (playlists.length === 0) {
|
|
5150
|
+
return [
|
|
5151
|
+
{
|
|
5152
|
+
type: "m3u-playlist",
|
|
5153
|
+
boxes: structure.boxes,
|
|
5154
|
+
src
|
|
5155
|
+
}
|
|
5156
|
+
];
|
|
5157
|
+
}
|
|
5149
5158
|
return playlists;
|
|
5150
5159
|
};
|
|
5151
5160
|
var getPlaylist = (structure, src) => {
|
|
@@ -12188,6 +12197,15 @@ var parseM3uDirective = (str) => {
|
|
|
12188
12197
|
value: p.URI
|
|
12189
12198
|
};
|
|
12190
12199
|
}
|
|
12200
|
+
if (directive === "#EXT-X-PROGRAM-DATE-TIME") {
|
|
12201
|
+
if (!value) {
|
|
12202
|
+
throw new Error("#EXT-X-PROGRAM-DATE-TIME directive must have a value");
|
|
12203
|
+
}
|
|
12204
|
+
return {
|
|
12205
|
+
type: "m3u-program-date-time",
|
|
12206
|
+
dateTime: value
|
|
12207
|
+
};
|
|
12208
|
+
}
|
|
12191
12209
|
throw new Error(`Unknown directive ${directive}. Value: ${value}`);
|
|
12192
12210
|
};
|
|
12193
12211
|
|
|
@@ -12239,7 +12257,8 @@ var afterManifestFetch = async ({
|
|
|
12239
12257
|
canSkipTracks
|
|
12240
12258
|
}) => {
|
|
12241
12259
|
const independentSegments = isIndependentSegments(structure);
|
|
12242
|
-
|
|
12260
|
+
const streams = getM3uStreams({ structure, originalSrc: src, readerInterface });
|
|
12261
|
+
if (!independentSegments || streams === null) {
|
|
12243
12262
|
if (!src) {
|
|
12244
12263
|
throw new Error("No src");
|
|
12245
12264
|
}
|
|
@@ -12249,10 +12268,6 @@ var afterManifestFetch = async ({
|
|
|
12249
12268
|
});
|
|
12250
12269
|
return m3uState.setReadyToIterateOverM3u();
|
|
12251
12270
|
}
|
|
12252
|
-
const streams = getM3uStreams({ structure, originalSrc: src, readerInterface });
|
|
12253
|
-
if (streams === null) {
|
|
12254
|
-
throw new Error("No streams found");
|
|
12255
|
-
}
|
|
12256
12271
|
const selectedPlaylist = await selectStream({ streams, fn: selectM3uStreamFn });
|
|
12257
12272
|
if (!selectedPlaylist.dimensions) {
|
|
12258
12273
|
throw new Error("Stream does not have a resolution");
|
package/dist/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.0.
|
|
1
|
+
export declare const VERSION = "4.0.387";
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/media-parser"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/media-parser",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.387",
|
|
7
7
|
"main": "dist/index.js",
|
|
8
8
|
"sideEffects": false,
|
|
9
9
|
"scripts": {
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
"prepublishOnly": "bun ensure-correct-version.ts"
|
|
15
15
|
},
|
|
16
16
|
"devDependencies": {
|
|
17
|
-
"@remotion/example-videos": "4.0.
|
|
17
|
+
"@remotion/example-videos": "4.0.387",
|
|
18
18
|
"@types/wicg-file-system-access": "2023.10.5",
|
|
19
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
19
|
+
"@remotion/eslint-config-internal": "4.0.387",
|
|
20
20
|
"eslint": "9.19.0",
|
|
21
21
|
"mediabunny": "1.25.8",
|
|
22
22
|
"@types/bun": "1.3.3"
|