@skax/hls-io 0.1.0-beta.1

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/README.md ADDED
@@ -0,0 +1,77 @@
1
+ # @skax/hls-io
2
+
3
+ > A comprehensive HLS (HTTP Live Streaming) IO client written in TypeScript.
4
+
5
+ > 一个用 TypeScript 编写的全功能 HLS(HTTP 实时流)IO 客户端。
6
+
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
8
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.9-blue)](https://www.typescriptlang.org/)
9
+ [![Test Coverage](https://img.shields.io/badge/tests-294%20passed-green)]()
10
+
11
+ ---
12
+
13
+ ## 📖 Documentation · 文档
14
+
15
+ | Language | File |
16
+ | -------- | ------------------------------ |
17
+ | English | [README-en.md](./README-en.md) |
18
+ | 中文 | [README-zh.md](./README-zh.md) |
19
+
20
+ ---
21
+
22
+ ## ⚡ Quick Start · 快速开始
23
+
24
+ ```bash
25
+ npm install @skax/hls-io
26
+
27
+ # or yarn
28
+ yarn add @skax/hls-io
29
+
30
+ # or pnpm
31
+ pnpm add @skax/hls-io
32
+ ```
33
+
34
+ ```typescript
35
+ import { HlsIO, HlsIOEvents } from "@skax/hls-io";
36
+
37
+ const hls = new HlsIO({ url: "https://example.com/stream.m3u8" });
38
+
39
+ hls.on(HlsIOEvents.SEGMENT_READY, (segment) => {
40
+ console.log(`Segment #${segment.sequence} ready`);
41
+ // Feed segment.data (ArrayBuffer) to MSE / player
42
+ });
43
+
44
+ await hls.start();
45
+ ```
46
+
47
+ ## ✨ Highlights · 亮点
48
+
49
+ - 🎬 **Live & VOD** — Auto-detection, configurable mode
50
+ - 📦 **ts & fmp4** — Full MPEG-TS / Fragmented MP4 support
51
+ - 🔗 **URI Resolution** — Relative, absolute, and protocol-relative paths
52
+ - 🔄 **LL-HLS** — `EXT-X-PART`, `EXT-X-PRELOAD-HINT`, `EXT-X-SERVER-CONTROL`
53
+ - 🔁 **Retry** — Exponential backoff with configurable attempts
54
+ - 💓 **Heartbeat** — Configurable keepalive with event callback
55
+ - 💾 **Cache** — LRU / FIFO with eviction policies and stats
56
+ - 🔐 **Decryption** — AES-128-CBC (Web Crypto API) + custom key provider
57
+ - 🌐 **CORS** — Full fetch mode control, runtime configuration
58
+ - ⏱ **Duration & Buffer Tracking** — `DURATION_UPDATED` / `BUFFERED_TIME_UPDATED` events
59
+ - 🧪 **294 Tests** — 9 suites covering all modules
60
+
61
+ ## 🛠 Development · 开发
62
+
63
+ ```bash
64
+ npm install # 安装依赖
65
+ npm run build # 构建 (UMD + ESM)
66
+ npm run dev # 开发服务器 (port 4000)
67
+ npm test # 测试 (154 cases)
68
+ ```
69
+
70
+ ## 📂 More Resources · 更多资源
71
+
72
+ - [FAQ](./FAQ.md) — Frequently Asked Questions / 常见问题解答
73
+ - [Demo](./public/index.html) — Interactive demo page / 交互式演示
74
+
75
+ ## License
76
+
77
+ MIT