@flow-player/test-streams 0.15.1 → 0.17.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/config.d.ts +1 -4
- package/dist/fixtures/codec.d.ts +1 -0
- package/dist/fixtures/format.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +6 -2
- package/dist/server/routes.d.ts +0 -17
- package/dist/server/static.d.ts +2 -1
- package/dist/urls.d.ts +4 -0
- package/dist/urls.js +21 -0
- package/package.json +5 -1
package/dist/config.d.ts
CHANGED
|
@@ -6,10 +6,7 @@ export declare const DEFAULT_HOST = "127.0.0.1";
|
|
|
6
6
|
export declare const DEFAULT_FIXTURE_DIR = "fixtures";
|
|
7
7
|
/** 每条 VOD fixture 的默认时长(秒)。 */
|
|
8
8
|
export declare const DEFAULT_DURATION_SECONDS = 5;
|
|
9
|
-
|
|
10
|
-
export declare const DEFAULT_VIDEO_HEIGHT = 720;
|
|
11
|
-
export declare const DEFAULT_VIDEO_FPS = 25;
|
|
12
|
-
export declare const DEFAULT_GOP_SECONDS = 1;
|
|
9
|
+
/** HLS fixture 分片时长(秒)。 */
|
|
13
10
|
export declare const DEFAULT_HLS_SEGMENT_SECONDS = 2;
|
|
14
11
|
/** generateFixtures 的选项;全部可选,缺省即完整矩阵 + 默认时长。 */
|
|
15
12
|
export type GenerateOptions = {
|
package/dist/fixtures/codec.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -7,4 +7,4 @@ export { ALL_CODECS, ALL_FORMATS, DEFAULT_DURATION_SECONDS, DEFAULT_FIXTURE_DIR,
|
|
|
7
7
|
export { createStreamsServer, type StreamsServerHandle } from "./server/server.js";
|
|
8
8
|
export { generateFixtures, type GenerateResult } from "./fixtures/generate.js";
|
|
9
9
|
export { handleLiveStream, matchLivePath, type LiveStreamOptions } from "./server/live.js";
|
|
10
|
-
export { liveStreamUrl, vodStreamUrl } from "./urls.js";
|
|
10
|
+
export { LIVE_STREAM_PATH_PREFIX, VOD_FIXTURE_PATH_PREFIX, liveStreamUrl, vodStreamUrl, } from "./urls.js";
|
package/dist/index.js
CHANGED
|
@@ -1452,17 +1452,19 @@ function emptyManifest(duration) {
|
|
|
1452
1452
|
}
|
|
1453
1453
|
|
|
1454
1454
|
// src/urls.ts
|
|
1455
|
+
var LIVE_STREAM_PATH_PREFIX = "/streams/live/";
|
|
1456
|
+
var VOD_FIXTURE_PATH_PREFIX = "/streams/";
|
|
1455
1457
|
function joinBase(base, path) {
|
|
1456
1458
|
return `${base.replace(/\/+$/, "")}${path}`;
|
|
1457
1459
|
}
|
|
1458
1460
|
function vodStreamUrl(base, format, codec) {
|
|
1459
|
-
const root = joinBase(base,
|
|
1461
|
+
const root = joinBase(base, `${VOD_FIXTURE_PATH_PREFIX}${format}/${codec}`);
|
|
1460
1462
|
if (format === "hls") return `${root}/master.m3u8`;
|
|
1461
1463
|
if (format === "fmp4") return `${root}/init.mp4`;
|
|
1462
1464
|
return root;
|
|
1463
1465
|
}
|
|
1464
1466
|
function liveStreamUrl(base, format, codec) {
|
|
1465
|
-
return joinBase(base,
|
|
1467
|
+
return joinBase(base, `${LIVE_STREAM_PATH_PREFIX}${format}/${codec}`);
|
|
1466
1468
|
}
|
|
1467
1469
|
export {
|
|
1468
1470
|
ALL_CODECS,
|
|
@@ -1475,6 +1477,8 @@ export {
|
|
|
1475
1477
|
DEFAULT_HOST,
|
|
1476
1478
|
DEFAULT_PORT,
|
|
1477
1479
|
DRAWTEXT_FONT_CANDIDATES,
|
|
1480
|
+
LIVE_STREAM_PATH_PREFIX,
|
|
1481
|
+
VOD_FIXTURE_PATH_PREFIX,
|
|
1478
1482
|
VOD_SAMPLE_RELATIVE,
|
|
1479
1483
|
WINDOW_CONTAINER_DIR,
|
|
1480
1484
|
WINDOW_SPECS,
|
package/dist/server/routes.d.ts
CHANGED
|
@@ -3,24 +3,7 @@ import { type Manifest } from "../fixtures/catalog.js";
|
|
|
3
3
|
export declare function resolveRoute(path: string): string | null;
|
|
4
4
|
export declare function handleHealth(res: ServerResponse, manifest: Manifest | null, fixtureDir: string): void;
|
|
5
5
|
export declare function handleList(res: ServerResponse, manifest: Manifest | null): void;
|
|
6
|
-
export type VodSegmentDescriptor = {
|
|
7
|
-
url: string;
|
|
8
|
-
startTimestamp: number;
|
|
9
|
-
endTimestamp: number;
|
|
10
|
-
timeLen: number;
|
|
11
|
-
fileSize: number;
|
|
12
|
-
channelID: number;
|
|
13
|
-
RecordType: number;
|
|
14
|
-
};
|
|
15
|
-
export type VodListResponse = {
|
|
16
|
-
segments: ReadonlyArray<VodSegmentDescriptor>;
|
|
17
|
-
};
|
|
18
6
|
export declare function handleVodList(res: ServerResponse, manifest: Manifest | null, fixtureDir: string, codec?: "h264" | "hevc"): void;
|
|
19
|
-
export type MultiVodListResponse = VodListResponse & {
|
|
20
|
-
channelIds: number[];
|
|
21
|
-
};
|
|
22
|
-
export declare const MULTI_VOD_MAX_CHANNELS = 9;
|
|
23
|
-
export declare const MULTI_VOD_DEFAULT_CHANNELS = 4;
|
|
24
7
|
export declare function parseChannelCount(raw: string | null): number;
|
|
25
8
|
/**
|
|
26
9
|
* live 流分辨率/帧率 query 解析:整数且落在 [min, max] 才采纳,否则返回 null
|
package/dist/server/static.d.ts
CHANGED
|
@@ -3,10 +3,11 @@ export declare function applyCors(res: ServerResponse): void;
|
|
|
3
3
|
export declare function writeJson(res: ServerResponse, status: number, body: unknown): void;
|
|
4
4
|
export declare function writeNotFound(res: ServerResponse): void;
|
|
5
5
|
export declare function writeBadRequest(res: ServerResponse, message: string): void;
|
|
6
|
-
|
|
6
|
+
type RangeInfo = {
|
|
7
7
|
alreadyServed: true;
|
|
8
8
|
} | {
|
|
9
9
|
start: number;
|
|
10
10
|
end: number;
|
|
11
11
|
} | null;
|
|
12
12
|
export declare function setRangeHeaders(req: IncomingMessage, res: ServerResponse, fullPath: string, mime: string): RangeInfo;
|
|
13
|
+
export {};
|
package/dist/urls.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { type CodecId, type FormatId } from "./config.js";
|
|
2
|
+
/** live 无限循环流路径前缀:完整形态 `/streams/live/<format>/<codec>`。 */
|
|
3
|
+
export declare const LIVE_STREAM_PATH_PREFIX = "/streams/live/";
|
|
4
|
+
/** 5s 预生成 VOD fixture 路径前缀:完整形态 `/streams/<format>/<codec>`。 */
|
|
5
|
+
export declare const VOD_FIXTURE_PATH_PREFIX = "/streams/";
|
|
2
6
|
/**
|
|
3
7
|
* 拼 5s 预生成 VOD fixture 的流 URL:`<base>/streams/<format>/<codec>`;
|
|
4
8
|
* base 尾部斜杠可有可无(内部归一化)。hls/fmp4 为容器目录布局,服务端要求
|
package/dist/urls.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// src/urls.ts
|
|
2
|
+
var LIVE_STREAM_PATH_PREFIX = "/streams/live/";
|
|
3
|
+
var VOD_FIXTURE_PATH_PREFIX = "/streams/";
|
|
4
|
+
function joinBase(base, path) {
|
|
5
|
+
return `${base.replace(/\/+$/, "")}${path}`;
|
|
6
|
+
}
|
|
7
|
+
function vodStreamUrl(base, format, codec) {
|
|
8
|
+
const root = joinBase(base, `${VOD_FIXTURE_PATH_PREFIX}${format}/${codec}`);
|
|
9
|
+
if (format === "hls") return `${root}/master.m3u8`;
|
|
10
|
+
if (format === "fmp4") return `${root}/init.mp4`;
|
|
11
|
+
return root;
|
|
12
|
+
}
|
|
13
|
+
function liveStreamUrl(base, format, codec) {
|
|
14
|
+
return joinBase(base, `${LIVE_STREAM_PATH_PREFIX}${format}/${codec}`);
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
LIVE_STREAM_PATH_PREFIX,
|
|
18
|
+
VOD_FIXTURE_PATH_PREFIX,
|
|
19
|
+
liveStreamUrl,
|
|
20
|
+
vodStreamUrl
|
|
21
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flow-player/test-streams",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
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",
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"types": "./dist/index.d.ts",
|
|
25
25
|
"default": "./dist/index.js"
|
|
26
26
|
},
|
|
27
|
+
"./urls": {
|
|
28
|
+
"types": "./dist/urls.d.ts",
|
|
29
|
+
"default": "./dist/urls.js"
|
|
30
|
+
},
|
|
27
31
|
"./server": {
|
|
28
32
|
"types": "./dist/server/server.d.ts",
|
|
29
33
|
"default": "./dist/server/server.js"
|