@flow-player/test-streams 0.6.1 → 0.6.2
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/cli/extend-vod.js +4 -4
- package/dist/cli/generate.js +9 -9
- package/dist/cli/serve.js +11 -11
- package/dist/fixtures/catalog.js +3 -3
- package/dist/fixtures/generate.js +7 -7
- package/dist/index.js +12 -12
- package/dist/server/server.js +9 -9
- package/dist/vite-plugin.js +1 -1
- package/package.json +1 -1
package/dist/cli/extend-vod.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/cli/extend-vod.ts
|
|
4
4
|
import { createHash } from "node:crypto";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { spawn } from "node:child_process";
|
|
7
7
|
import { join, resolve } from "node:path";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// src/config.ts
|
|
10
10
|
var DEFAULT_FIXTURE_DIR = "fixtures";
|
|
11
11
|
var ALL_CODECS = ["h264", "hevc"];
|
|
12
12
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// src/server/routes.ts
|
|
15
15
|
var FORMAT_SET = Object.fromEntries(ALL_FORMATS.map((f) => [f, true]));
|
|
16
16
|
var CODEC_SET = Object.fromEntries(ALL_CODECS.map((c) => [c, true]));
|
|
17
17
|
|
|
18
|
-
//
|
|
18
|
+
// src/cli/extend-vod.ts
|
|
19
19
|
function parseArgs(argv) {
|
|
20
20
|
const opts = {
|
|
21
21
|
fixtureDir: DEFAULT_FIXTURE_DIR,
|
package/dist/cli/generate.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/cli/generate.ts
|
|
4
4
|
import { dirname, resolve as resolve2 } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// src/config.ts
|
|
8
8
|
var DEFAULT_FIXTURE_DIR = "fixtures";
|
|
9
9
|
var DEFAULT_DURATION_SECONDS = 5;
|
|
10
10
|
var ALL_CODECS = ["h264", "hevc"];
|
|
11
11
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// src/fixtures/generate.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
15
15
|
import {
|
|
16
16
|
existsSync,
|
|
@@ -24,10 +24,10 @@ import {
|
|
|
24
24
|
import { spawn } from "node:child_process";
|
|
25
25
|
import { join as join3, resolve } from "node:path";
|
|
26
26
|
|
|
27
|
-
//
|
|
27
|
+
// src/fixtures/matrix.ts
|
|
28
28
|
import { join as join2 } from "node:path";
|
|
29
29
|
|
|
30
|
-
//
|
|
30
|
+
// src/fixtures/codec.ts
|
|
31
31
|
var CODEC_SPEC = {
|
|
32
32
|
h264: {
|
|
33
33
|
codec: "h264",
|
|
@@ -52,7 +52,7 @@ function containerExtraArgs(format, codec) {
|
|
|
52
52
|
return [];
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
//
|
|
55
|
+
// src/fixtures/format.ts
|
|
56
56
|
import { join } from "node:path";
|
|
57
57
|
function formatSpecific(format) {
|
|
58
58
|
if (format === "flv") return ["-f", "flv"];
|
|
@@ -147,7 +147,7 @@ function containerRelativePath(codec, format, name) {
|
|
|
147
147
|
return join(containerRelativeDir(codec, format), name);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
//
|
|
150
|
+
// src/fixtures/matrix.ts
|
|
151
151
|
function buildPlan(codec, format, durationSeconds) {
|
|
152
152
|
const layout = layoutFor(codec, format);
|
|
153
153
|
const spec = CODEC_SPEC[codec];
|
|
@@ -208,7 +208,7 @@ function expandMatrix(opts) {
|
|
|
208
208
|
}
|
|
209
209
|
var VOD_SAMPLE_RELATIVE = "mp4/h264.mp4";
|
|
210
210
|
|
|
211
|
-
//
|
|
211
|
+
// src/fixtures/generate.ts
|
|
212
212
|
var FFMPEG_PROBE_ARGS = ["-version"];
|
|
213
213
|
async function generateFixtures(opts = {}) {
|
|
214
214
|
const ffmpegPath = opts.ffmpegPath ?? await findFfmpeg();
|
|
@@ -363,7 +363,7 @@ function emptyManifest(duration) {
|
|
|
363
363
|
};
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
-
//
|
|
366
|
+
// src/cli/generate.ts
|
|
367
367
|
var here = dirname(fileURLToPath(import.meta.url));
|
|
368
368
|
var repoRoot = resolve2(here, "..", "..", "..");
|
|
369
369
|
var CODEC_SET = { h264: true, hevc: true };
|
package/dist/cli/serve.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
//
|
|
3
|
+
// src/cli/serve.ts
|
|
4
4
|
import { dirname, resolve as resolve3 } from "node:path";
|
|
5
5
|
import { fileURLToPath } from "node:url";
|
|
6
6
|
|
|
7
|
-
//
|
|
7
|
+
// src/config.ts
|
|
8
8
|
var DEFAULT_PORT = 4177;
|
|
9
9
|
var DEFAULT_HOST = "127.0.0.1";
|
|
10
10
|
var DEFAULT_FIXTURE_DIR = "fixtures";
|
|
11
11
|
var ALL_CODECS = ["h264", "hevc"];
|
|
12
12
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
13
13
|
|
|
14
|
-
//
|
|
14
|
+
// src/server/server.ts
|
|
15
15
|
import { createReadStream as createReadStream2, readFileSync as readFileSync3 } from "node:fs";
|
|
16
16
|
import {
|
|
17
17
|
createServer as createHttpServer
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
import { createServer as createHttpsServer } from "node:https";
|
|
20
20
|
import { extname, resolve as resolve2, sep } from "node:path";
|
|
21
21
|
|
|
22
|
-
//
|
|
22
|
+
// src/fixtures/catalog.ts
|
|
23
23
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
24
24
|
import { resolve } from "node:path";
|
|
25
25
|
function loadManifest(fixtureDir) {
|
|
@@ -49,7 +49,7 @@ function summarizeCatalog(fixtureDir) {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
//
|
|
52
|
+
// src/server/static.ts
|
|
53
53
|
import { createReadStream, statSync as statSync2 } from "node:fs";
|
|
54
54
|
function applyCors(res) {
|
|
55
55
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
@@ -109,7 +109,7 @@ function setRangeHeaders(req, res, fullPath, mime) {
|
|
|
109
109
|
return { start, end };
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
//
|
|
112
|
+
// src/server/routes.ts
|
|
113
113
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
114
114
|
import { join } from "node:path";
|
|
115
115
|
var FORMAT_SET = Object.fromEntries(ALL_FORMATS.map((f) => [f, true]));
|
|
@@ -210,10 +210,10 @@ function handleVodList(res, manifest, fixtureDir) {
|
|
|
210
210
|
});
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
-
//
|
|
213
|
+
// src/server/live.ts
|
|
214
214
|
import { spawn } from "node:child_process";
|
|
215
215
|
|
|
216
|
-
//
|
|
216
|
+
// src/fixtures/codec.ts
|
|
217
217
|
var CODEC_SPEC = {
|
|
218
218
|
h264: {
|
|
219
219
|
codec: "h264",
|
|
@@ -233,7 +233,7 @@ var CODEC_SPEC = {
|
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
-
//
|
|
236
|
+
// src/server/live.ts
|
|
237
237
|
var LIVE_MIME = {
|
|
238
238
|
flv: "video/x-flv",
|
|
239
239
|
hls: "application/vnd.apple.mpegurl",
|
|
@@ -394,7 +394,7 @@ function liveLowLatencyVideoArgs(codec) {
|
|
|
394
394
|
return [];
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
-
//
|
|
397
|
+
// src/server/server.ts
|
|
398
398
|
function createStreamsServer(options) {
|
|
399
399
|
const host = options.host ?? DEFAULT_HOST;
|
|
400
400
|
const port = options.port ?? DEFAULT_PORT;
|
|
@@ -536,7 +536,7 @@ function decodePath(rawTarget) {
|
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
-
//
|
|
539
|
+
// src/cli/serve.ts
|
|
540
540
|
var here = dirname(fileURLToPath(import.meta.url));
|
|
541
541
|
function parseArgs(argv) {
|
|
542
542
|
const parsed = {
|
package/dist/fixtures/catalog.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/fixtures/catalog.ts
|
|
2
2
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
|
|
5
|
-
//
|
|
5
|
+
// src/config.ts
|
|
6
6
|
var ALL_CODECS = ["h264", "hevc"];
|
|
7
7
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// src/fixtures/catalog.ts
|
|
10
10
|
function loadManifest(fixtureDir) {
|
|
11
11
|
const path = resolve(fixtureDir, "manifest.json");
|
|
12
12
|
if (!existsSync(path)) return null;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/fixtures/generate.ts
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import {
|
|
4
4
|
existsSync,
|
|
@@ -12,16 +12,16 @@ import {
|
|
|
12
12
|
import { spawn } from "node:child_process";
|
|
13
13
|
import { join as join3, resolve } from "node:path";
|
|
14
14
|
|
|
15
|
-
//
|
|
15
|
+
// src/config.ts
|
|
16
16
|
var DEFAULT_FIXTURE_DIR = "fixtures";
|
|
17
17
|
var DEFAULT_DURATION_SECONDS = 5;
|
|
18
18
|
var ALL_CODECS = ["h264", "hevc"];
|
|
19
19
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
20
20
|
|
|
21
|
-
//
|
|
21
|
+
// src/fixtures/matrix.ts
|
|
22
22
|
import { join as join2 } from "node:path";
|
|
23
23
|
|
|
24
|
-
//
|
|
24
|
+
// src/fixtures/codec.ts
|
|
25
25
|
var CODEC_SPEC = {
|
|
26
26
|
h264: {
|
|
27
27
|
codec: "h264",
|
|
@@ -46,7 +46,7 @@ function containerExtraArgs(format, codec) {
|
|
|
46
46
|
return [];
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
//
|
|
49
|
+
// src/fixtures/format.ts
|
|
50
50
|
import { join } from "node:path";
|
|
51
51
|
function formatSpecific(format) {
|
|
52
52
|
if (format === "flv") return ["-f", "flv"];
|
|
@@ -141,7 +141,7 @@ function containerRelativePath(codec, format, name) {
|
|
|
141
141
|
return join(containerRelativeDir(codec, format), name);
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
//
|
|
144
|
+
// src/fixtures/matrix.ts
|
|
145
145
|
function buildPlan(codec, format, durationSeconds) {
|
|
146
146
|
const layout = layoutFor(codec, format);
|
|
147
147
|
const spec = CODEC_SPEC[codec];
|
|
@@ -202,7 +202,7 @@ function expandMatrix(opts) {
|
|
|
202
202
|
}
|
|
203
203
|
var VOD_SAMPLE_RELATIVE = "mp4/h264.mp4";
|
|
204
204
|
|
|
205
|
-
//
|
|
205
|
+
// src/fixtures/generate.ts
|
|
206
206
|
var FFMPEG_PROBE_ARGS = ["-version"];
|
|
207
207
|
async function generateFixtures(opts = {}) {
|
|
208
208
|
const ffmpegPath = opts.ffmpegPath ?? await findFfmpeg();
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/fixtures/matrix.ts
|
|
2
2
|
import { join as join2 } from "node:path";
|
|
3
3
|
|
|
4
|
-
//
|
|
4
|
+
// src/config.ts
|
|
5
5
|
var DEFAULT_PORT = 4177;
|
|
6
6
|
var DEFAULT_HOST = "127.0.0.1";
|
|
7
7
|
var DEFAULT_FIXTURE_DIR = "fixtures";
|
|
@@ -10,7 +10,7 @@ var DEFAULT_HLS_SEGMENT_SECONDS = 2;
|
|
|
10
10
|
var ALL_CODECS = ["h264", "hevc"];
|
|
11
11
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
12
12
|
|
|
13
|
-
//
|
|
13
|
+
// src/fixtures/codec.ts
|
|
14
14
|
var CODEC_SPEC = {
|
|
15
15
|
h264: {
|
|
16
16
|
codec: "h264",
|
|
@@ -35,7 +35,7 @@ function containerExtraArgs(format, codec) {
|
|
|
35
35
|
return [];
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
//
|
|
38
|
+
// src/fixtures/format.ts
|
|
39
39
|
import { join } from "node:path";
|
|
40
40
|
function formatSpecific(format) {
|
|
41
41
|
if (format === "flv") return ["-f", "flv"];
|
|
@@ -130,7 +130,7 @@ function containerRelativePath(codec, format, name) {
|
|
|
130
130
|
return join(containerRelativeDir(codec, format), name);
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
//
|
|
133
|
+
// src/fixtures/matrix.ts
|
|
134
134
|
function buildPlan(codec, format, durationSeconds) {
|
|
135
135
|
const layout = layoutFor(codec, format);
|
|
136
136
|
const spec = CODEC_SPEC[codec];
|
|
@@ -191,7 +191,7 @@ function expandMatrix(opts) {
|
|
|
191
191
|
}
|
|
192
192
|
var VOD_SAMPLE_RELATIVE = "mp4/h264.mp4";
|
|
193
193
|
|
|
194
|
-
//
|
|
194
|
+
// src/fixtures/catalog.ts
|
|
195
195
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
196
196
|
import { resolve } from "node:path";
|
|
197
197
|
function loadManifest(fixtureDir) {
|
|
@@ -243,7 +243,7 @@ function verifyEntryOnDisk(fixtureDir, entry) {
|
|
|
243
243
|
return { ok: true, size };
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
//
|
|
246
|
+
// src/server/server.ts
|
|
247
247
|
import { createReadStream as createReadStream2, readFileSync as readFileSync3 } from "node:fs";
|
|
248
248
|
import {
|
|
249
249
|
createServer as createHttpServer
|
|
@@ -251,7 +251,7 @@ import {
|
|
|
251
251
|
import { createServer as createHttpsServer } from "node:https";
|
|
252
252
|
import { extname, resolve as resolve2, sep } from "node:path";
|
|
253
253
|
|
|
254
|
-
//
|
|
254
|
+
// src/server/static.ts
|
|
255
255
|
import { createReadStream, statSync as statSync2 } from "node:fs";
|
|
256
256
|
function applyCors(res) {
|
|
257
257
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
@@ -311,7 +311,7 @@ function setRangeHeaders(req, res, fullPath, mime) {
|
|
|
311
311
|
return { start, end };
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
//
|
|
314
|
+
// src/server/routes.ts
|
|
315
315
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
316
316
|
import { join as join3 } from "node:path";
|
|
317
317
|
var FORMAT_SET = Object.fromEntries(ALL_FORMATS.map((f) => [f, true]));
|
|
@@ -412,7 +412,7 @@ function handleVodList(res, manifest, fixtureDir) {
|
|
|
412
412
|
});
|
|
413
413
|
}
|
|
414
414
|
|
|
415
|
-
//
|
|
415
|
+
// src/server/live.ts
|
|
416
416
|
import { spawn } from "node:child_process";
|
|
417
417
|
var LIVE_MIME = {
|
|
418
418
|
flv: "video/x-flv",
|
|
@@ -574,7 +574,7 @@ function liveLowLatencyVideoArgs(codec) {
|
|
|
574
574
|
return [];
|
|
575
575
|
}
|
|
576
576
|
|
|
577
|
-
//
|
|
577
|
+
// src/server/server.ts
|
|
578
578
|
function createStreamsServer(options) {
|
|
579
579
|
const host = options.host ?? DEFAULT_HOST;
|
|
580
580
|
const port = options.port ?? DEFAULT_PORT;
|
|
@@ -702,7 +702,7 @@ function decodePath(rawTarget) {
|
|
|
702
702
|
}
|
|
703
703
|
}
|
|
704
704
|
|
|
705
|
-
//
|
|
705
|
+
// src/fixtures/generate.ts
|
|
706
706
|
import { createHash } from "node:crypto";
|
|
707
707
|
import {
|
|
708
708
|
existsSync as existsSync3,
|
package/dist/server/server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// src/server/server.ts
|
|
2
2
|
import { createReadStream as createReadStream2, readFileSync as readFileSync3 } from "node:fs";
|
|
3
3
|
import {
|
|
4
4
|
createServer as createHttpServer
|
|
@@ -6,13 +6,13 @@ import {
|
|
|
6
6
|
import { createServer as createHttpsServer } from "node:https";
|
|
7
7
|
import { extname, resolve as resolve2, sep } from "node:path";
|
|
8
8
|
|
|
9
|
-
//
|
|
9
|
+
// src/config.ts
|
|
10
10
|
var DEFAULT_PORT = 4177;
|
|
11
11
|
var DEFAULT_HOST = "127.0.0.1";
|
|
12
12
|
var ALL_CODECS = ["h264", "hevc"];
|
|
13
13
|
var ALL_FORMATS = ["flv", "hls", "mp4", "fmp4", "ts"];
|
|
14
14
|
|
|
15
|
-
//
|
|
15
|
+
// src/fixtures/catalog.ts
|
|
16
16
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
17
17
|
import { resolve } from "node:path";
|
|
18
18
|
function loadManifest(fixtureDir) {
|
|
@@ -42,7 +42,7 @@ function summarizeCatalog(fixtureDir) {
|
|
|
42
42
|
};
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
//
|
|
45
|
+
// src/server/static.ts
|
|
46
46
|
import { createReadStream, statSync as statSync2 } from "node:fs";
|
|
47
47
|
function applyCors(res) {
|
|
48
48
|
res.setHeader("Access-Control-Allow-Origin", "*");
|
|
@@ -102,7 +102,7 @@ function setRangeHeaders(req, res, fullPath, mime) {
|
|
|
102
102
|
return { start, end };
|
|
103
103
|
}
|
|
104
104
|
|
|
105
|
-
//
|
|
105
|
+
// src/server/routes.ts
|
|
106
106
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "node:fs";
|
|
107
107
|
import { join } from "node:path";
|
|
108
108
|
var FORMAT_SET = Object.fromEntries(ALL_FORMATS.map((f) => [f, true]));
|
|
@@ -203,10 +203,10 @@ function handleVodList(res, manifest, fixtureDir) {
|
|
|
203
203
|
});
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
//
|
|
206
|
+
// src/server/live.ts
|
|
207
207
|
import { spawn } from "node:child_process";
|
|
208
208
|
|
|
209
|
-
//
|
|
209
|
+
// src/fixtures/codec.ts
|
|
210
210
|
var CODEC_SPEC = {
|
|
211
211
|
h264: {
|
|
212
212
|
codec: "h264",
|
|
@@ -226,7 +226,7 @@ var CODEC_SPEC = {
|
|
|
226
226
|
}
|
|
227
227
|
};
|
|
228
228
|
|
|
229
|
-
//
|
|
229
|
+
// src/server/live.ts
|
|
230
230
|
var LIVE_MIME = {
|
|
231
231
|
flv: "video/x-flv",
|
|
232
232
|
hls: "application/vnd.apple.mpegurl",
|
|
@@ -387,7 +387,7 @@ function liveLowLatencyVideoArgs(codec) {
|
|
|
387
387
|
return [];
|
|
388
388
|
}
|
|
389
389
|
|
|
390
|
-
//
|
|
390
|
+
// src/server/server.ts
|
|
391
391
|
function createStreamsServer(options) {
|
|
392
392
|
const host = options.host ?? DEFAULT_HOST;
|
|
393
393
|
const port = options.port ?? DEFAULT_PORT;
|
package/dist/vite-plugin.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flow-player/test-streams",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "ffmpeg-driven local test stream service for Flow Player integration testing: generates and serves H.264/HEVC × HTTP-FLV / HLS / fMP4 / MP4 / MPEG-TS fixtures on 127.0.0.1:4177 (live infinite-loop + 5s VOD fixtures).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"esm",
|