fluxkit-player 0.1.0 → 0.1.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/CHANGELOG.md +88 -9
- package/README.en.md +224 -0
- package/README.md +207 -98
- package/THIRD-PARTY-NOTICES.md +30 -0
- package/dist/fluxkit.js +2052 -479
- package/dist/fluxkit.js.map +1 -1
- package/dist/fluxkit.umd.cjs +75 -3
- package/dist/fluxkit.umd.cjs.map +1 -1
- package/dist/types/config.d.ts +21 -1
- package/dist/types/crypto/hls-aes.d.ts +13 -0
- package/dist/types/demux/flv.d.ts +2 -0
- package/dist/types/demux/hls.d.ts +25 -0
- package/dist/types/index.d.ts +3 -2
- package/dist/types/pipeline/timeline.d.ts +4 -0
- package/dist/types/player.d.ts +60 -1
- package/dist/types/render/audio.d.ts +13 -0
- package/dist/types/render/backlog.d.ts +27 -0
- package/dist/types/render/mse.d.ts +7 -0
- package/dist/types/render/software.d.ts +34 -1
- package/dist/types/render/subtitles.d.ts +36 -0
- package/dist/types/render/webcodecs.d.ts +4 -0
- package/dist/types/soft/index.d.ts +5 -0
- package/dist/types/soft/openh264.d.ts +21 -0
- package/dist/types/soft/soft-worker.d.ts +2 -0
- package/dist/types/soft/types.d.ts +2 -2
- package/dist/types/soft/worker-protocol.d.ts +52 -0
- package/dist/types/source/abr.d.ts +22 -0
- package/dist/types/source/hls.d.ts +39 -2
- package/dist/types/source/stream.d.ts +2 -1
- package/dist/types/types.d.ts +108 -0
- package/dist/types/ui/controls.d.ts +68 -0
- package/docs/PUBLISHING.md +142 -0
- package/docs/README.md +42 -0
- package/docs/TEST-REPORT.md +370 -0
- package/docs/USAGE.md +513 -0
- package/docs/architecture.md +213 -0
- package/docs/test-logs/build.txt +19 -0
- package/docs/test-logs/coverage.txt +64 -0
- package/docs/test-logs/e2e-firefox.txt +1667 -0
- package/docs/test-logs/e2e.txt +1667 -0
- package/docs/test-logs/environment.json +62 -0
- package/docs/test-logs/typecheck.txt +1 -0
- package/docs/test-logs/unit.txt +81 -0
- package/examples/README.md +53 -0
- package/examples/minimal.html +49 -0
- package/examples/react/FluxPlayer.tsx +48 -0
- package/examples/soft-worker.js +6 -0
- package/examples/vue/FluxPlayer.vue +47 -0
- package/package.json +22 -3
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"date": "2026-11-27",
|
|
3
|
+
"commit": "v0.1.1",
|
|
4
|
+
"os": "Ubuntu 24.04.5 LTS, Linux 7.0.0-34-generic x86_64, 32 cores",
|
|
5
|
+
"node": "v24.22.1",
|
|
6
|
+
"npm": "11.19.1",
|
|
7
|
+
"typescript": "5.9.3",
|
|
8
|
+
"vite": "8.3.8",
|
|
9
|
+
"vitest": "5.1.2",
|
|
10
|
+
"e2eBrowser": "HeadlessChrome 154.0.8037.57 (google-chrome --headless=new)",
|
|
11
|
+
"demoBrowser": "Chromium 152.0.7977.167 (OpenCode in-app browser)",
|
|
12
|
+
"headlessCapabilities": {
|
|
13
|
+
"mediaSource": {
|
|
14
|
+
"h264": true,
|
|
15
|
+
"hevc": false,
|
|
16
|
+
"aac": true,
|
|
17
|
+
"alaw": false
|
|
18
|
+
},
|
|
19
|
+
"webCodecsVideo": {
|
|
20
|
+
"h264": true,
|
|
21
|
+
"hevc": false
|
|
22
|
+
},
|
|
23
|
+
"webCodecsAudio": {
|
|
24
|
+
"aac": true,
|
|
25
|
+
"alaw": true,
|
|
26
|
+
"ulaw": true
|
|
27
|
+
},
|
|
28
|
+
"webgl": true
|
|
29
|
+
},
|
|
30
|
+
"demoBrowserCapabilities": {
|
|
31
|
+
"mediaSource": {
|
|
32
|
+
"h264": true,
|
|
33
|
+
"hevc": true,
|
|
34
|
+
"aac": true,
|
|
35
|
+
"alaw": false
|
|
36
|
+
},
|
|
37
|
+
"webCodecsVideo": {
|
|
38
|
+
"h264": true,
|
|
39
|
+
"hevc": true
|
|
40
|
+
},
|
|
41
|
+
"webCodecsAudio": {
|
|
42
|
+
"aac": true,
|
|
43
|
+
"alaw": true,
|
|
44
|
+
"ulaw": true
|
|
45
|
+
},
|
|
46
|
+
"webgl": true
|
|
47
|
+
},
|
|
48
|
+
"e2eScenarios": 28,
|
|
49
|
+
"unitTests": 71,
|
|
50
|
+
"coverage": {
|
|
51
|
+
"statements": 45.23,
|
|
52
|
+
"branches": 32.46,
|
|
53
|
+
"functions": 47.67,
|
|
54
|
+
"lines": 47.05
|
|
55
|
+
},
|
|
56
|
+
"e2eScenariosFirefox": 28,
|
|
57
|
+
"browsers": [
|
|
58
|
+
"HeadlessChrome 154.0.8037.57",
|
|
59
|
+
"Firefox 158.0 (geckodriver/WebDriver)"
|
|
60
|
+
],
|
|
61
|
+
"version": "0.1.1"
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
exit:0
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
|
|
2
|
+
RUN v5.1.2 /home/weichengmeng/project/kit
|
|
3
|
+
|
|
4
|
+
✓ test/hls-aes.test.ts > HLS AES-128 > round-trips a non-block-aligned segment and removes PKCS#7 padding 6ms
|
|
5
|
+
✓ test/hls-aes.test.ts > HLS AES-128 > rejects a wrong key 1ms
|
|
6
|
+
✓ test/hls-aes.test.ts > HLS AES-128 > builds the implicit IV from the media sequence number 0ms
|
|
7
|
+
✓ test/hls-aes.test.ts > HLS AES-128 > parses explicit IVs and falls back to the sequence IV 1ms
|
|
8
|
+
✓ test/hls-aes.test.ts > HLS AES-128 > rejects keys that are not 16 bytes 0ms
|
|
9
|
+
✓ test/hls-aes.test.ts > HLS AES-256-GCM > decrypts IV || ciphertext || tag 2ms
|
|
10
|
+
✓ test/hls-aes.test.ts > HLS AES-256-GCM > rejects a tampered tag and a 16-byte key 0ms
|
|
11
|
+
✓ test/hls.test.ts > HLS playlists > parses a master playlist and resolves relative URIs 3ms
|
|
12
|
+
✓ test/hls.test.ts > HLS playlists > parses a VOD media playlist with keyframes 1ms
|
|
13
|
+
✓ test/hls.test.ts > HLS playlists > parses live playlists with discontinuity and keys 0ms
|
|
14
|
+
✓ test/hls.test.ts > HLS playlists > parses the discontinuity sequence across playlist reloads 0ms
|
|
15
|
+
✓ test/hls.test.ts > HLS playlists > parses LL-HLS parts and server control tags 1ms
|
|
16
|
+
✓ test/hls.test.ts > HLS playlists > parses part byte ranges and gaps 1ms
|
|
17
|
+
✓ test/hls.test.ts > HLS playlists > handles part byte-range offsets and URI-less gap parts 1ms
|
|
18
|
+
✓ test/hls.test.ts > HLS playlists > handles byte ranges 0ms
|
|
19
|
+
✓ test/backlog.test.ts > planLiveResync > does nothing when the queue starts at the live edge 2ms
|
|
20
|
+
✓ test/backlog.test.ts > planLiveResync > does nothing for an empty queue 0ms
|
|
21
|
+
✓ test/backlog.test.ts > planLiveResync > keeps a keyframe just before now 0ms
|
|
22
|
+
✓ test/backlog.test.ts > planLiveResync > drops whole GOPs up to the next usable keyframe 0ms
|
|
23
|
+
✓ test/backlog.test.ts > planLiveResync > chooses the oldest keyframe at or after now 0ms
|
|
24
|
+
✓ test/backlog.test.ts > planLiveResync > waits for a keyframe when none is buffered 0ms
|
|
25
|
+
✓ test/backlog.test.ts > planLiveResync > honours a custom tolerance 0ms
|
|
26
|
+
✓ test/fmp4.test.ts > fMP4 muxer > builds ftyp + moov with a single avc1 track 4ms
|
|
27
|
+
✓ test/fmp4.test.ts > fMP4 muxer > builds an audio init segment with esds 1ms
|
|
28
|
+
✓ test/fmp4.test.ts > fMP4 muxer > builds an MP3 audio init segment with the MPEG audio object type 1ms
|
|
29
|
+
✓ test/fmp4.test.ts > fMP4 muxer > writes moof + mdat with a correct data offset 1ms
|
|
30
|
+
✓ test/fmp4.test.ts > fMP4 muxer > encodes composition offsets for B-frames 0ms
|
|
31
|
+
✓ test/flv.test.ts > FLV demuxer > parses AVC + AAC configuration and keyframes 5ms
|
|
32
|
+
✓ test/flv.test.ts > FLV demuxer > detects G.711 A-law audio from IP cameras 1ms
|
|
33
|
+
✓ test/flv.test.ts > FLV demuxer > handles Enhanced-RTMP HEVC fourCC tags 0ms
|
|
34
|
+
✓ test/codec.test.ts > AAC helpers > round-trips AudioSpecificConfig 2ms
|
|
35
|
+
✓ test/codec.test.ts > AAC helpers > parses an ADTS header 1ms
|
|
36
|
+
✓ test/codec.test.ts > H.264 helpers > splits Annex-B and rebuilds AVCC 1ms
|
|
37
|
+
✓ test/codec.test.ts > H.264 helpers > builds an avcC and a codec string 1ms
|
|
38
|
+
✓ test/codec.test.ts > H.265 helpers > builds hvcC and a correct codec string 1ms
|
|
39
|
+
✓ test/amf0.test.ts > AMF0 > round-trips primitives and objects 3ms
|
|
40
|
+
✓ test/amf0.test.ts > AMF0 > encodes multiple command values 1ms
|
|
41
|
+
✓ test/amf0.test.ts > AMF0 > encodes long strings with the 0x0c marker 1ms
|
|
42
|
+
✓ test/soft.test.ts > software decoders > rejects High profile H.264 with a clear error 4ms
|
|
43
|
+
✓ test/soft.test.ts > software decoders > accepts Baseline and injects SPS/PPS before a keyframe 2ms
|
|
44
|
+
✓ test/soft.test.ts > software decoders > feeds libde265 parameter sets from hvcC on keyframes 2ms
|
|
45
|
+
✓ test/soft.test.ts > software decoders > reports a missing module as SOFT_DECODER_MISSING 5ms
|
|
46
|
+
✓ test/abr.test.ts > videoCodecFamily > groups AVC and HEVC codec strings 1ms
|
|
47
|
+
✓ test/abr.test.ts > chooseAbrVariant > keeps the current variant in the hysteresis band 0ms
|
|
48
|
+
✓ test/abr.test.ts > chooseAbrVariant > steps down when the buffer is low 0ms
|
|
49
|
+
✓ test/abr.test.ts > chooseAbrVariant > keeps the current variant when throughput is healthy despite a low buffer 0ms
|
|
50
|
+
✓ test/abr.test.ts > chooseAbrVariant > does not step below the lowest variant 0ms
|
|
51
|
+
✓ test/abr.test.ts > chooseAbrVariant > steps up when the buffer is healthy and throughput is sufficient 0ms
|
|
52
|
+
✓ test/abr.test.ts > chooseAbrVariant > does not step up when throughput is below the next variant 0ms
|
|
53
|
+
✓ test/abr.test.ts > chooseAbrVariant > uses a lower high-buffer threshold for live streams 0ms
|
|
54
|
+
✓ test/abr.test.ts > chooseAbrVariant > returns null when the current URI is not in the ladder 0ms
|
|
55
|
+
✓ test/abr.test.ts > chooseAbrVariant > returns null for a single-variant ladder 0ms
|
|
56
|
+
✓ test/subtitles.test.ts > WebVTT parser > parses cues, ids/notes and strips markup 2ms
|
|
57
|
+
✓ test/subtitles.test.ts > WebVTT parser > applies the X-TIMESTAMP-MAP offset 0ms
|
|
58
|
+
✓ test/subtitles.test.ts > WebVTT parser > ignores malformed cue blocks 0ms
|
|
59
|
+
✓ test/hevc.test.ts > HEVC > parses a 1280x720 Main profile SPS 1ms
|
|
60
|
+
✓ test/hevc.test.ts > HEVC > builds an hvcC that round-trips 1ms
|
|
61
|
+
✓ test/hevc.test.ts > HEVC > produces a valid RFC 6381 codec string 0ms
|
|
62
|
+
✓ test/g711.test.ts > G.711 > decodes A-law positive/negative zero 2ms
|
|
63
|
+
✓ test/g711.test.ts > G.711 > decodes A-law near full scale 0ms
|
|
64
|
+
✓ test/g711.test.ts > G.711 > decodes mu-law silence and full scale 0ms
|
|
65
|
+
✓ test/g711.test.ts > G.711 > returns normalized floats 0ms
|
|
66
|
+
✓ test/pipeline.test.ts > Timeline > normalizes the first sample to zero and maps other tracks onto it 2ms
|
|
67
|
+
✓ test/pipeline.test.ts > Timeline > supports a non-zero start time 0ms
|
|
68
|
+
✓ test/pipeline.test.ts > Timeline > rebases forward timestamp jumps at a discontinuity 0ms
|
|
69
|
+
✓ test/pipeline.test.ts > Timeline > rebases backward timestamp jumps at a discontinuity 0ms
|
|
70
|
+
✓ test/pipeline.test.ts > Timeline > keeps the discontinuity offset for every later sample 0ms
|
|
71
|
+
✓ test/pipeline.test.ts > Timeline > rebases each track independently 0ms
|
|
72
|
+
✓ test/pipeline.test.ts > Timeline > clears discontinuity offsets on setStart 0ms
|
|
73
|
+
✓ test/pipeline.test.ts > Timeline > forces monotonic DTS 0ms
|
|
74
|
+
✓ test/pipeline.test.ts > Segmenter > cuts on video keyframes and computes durations 1ms
|
|
75
|
+
|
|
76
|
+
Test Files 13 passed (13)
|
|
77
|
+
Tests 71 passed (71)
|
|
78
|
+
Start at 09:01:59
|
|
79
|
+
Duration 156ms (import 41%, tests 29%, transform 20%, worker 9%)
|
|
80
|
+
|
|
81
|
+
exit:0
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Examples
|
|
2
|
+
|
|
3
|
+
| 文件 | 说明 |
|
|
4
|
+
|---|---|
|
|
5
|
+
| [minimal.html](./minimal.html) | 单文件 UMD 示例:输入 URL、播放、错误提示 |
|
|
6
|
+
| [react/FluxPlayer.tsx](./react/FluxPlayer.tsx) | React 函数组件封装 |
|
|
7
|
+
| [vue/FluxPlayer.vue](./vue/FluxPlayer.vue) | Vue 3 `<script setup>` 封装 |
|
|
8
|
+
| [soft-worker.js](./soft-worker.js) | 软解 Worker 入口(配合 `softDecode.worker`) |
|
|
9
|
+
|
|
10
|
+
## 本地跑 minimal.html
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm run build # 生成 dist/
|
|
14
|
+
python3 -m http.server 8080
|
|
15
|
+
# 打开 http://localhost:8080/examples/minimal.html
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
`minimal.html` 默认引用 CDN;本地调试把 script 改成 `../dist/fluxkit.umd.cjs`。
|
|
19
|
+
|
|
20
|
+
## Worker 软解
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// soft-worker.js
|
|
24
|
+
import { installSoftWorker } from 'fluxkit-player';
|
|
25
|
+
installSoftWorker(self);
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```ts
|
|
29
|
+
new FluxKit('#stage', {
|
|
30
|
+
softDecode: {
|
|
31
|
+
worker: '/soft-worker.js',
|
|
32
|
+
modules: {
|
|
33
|
+
hevc: 'https://cdn.jsdelivr.net/npm/@yume-chan/libde265@1.0.0/libde265.mjs',
|
|
34
|
+
avc: 'https://cdn.jsdelivr.net/npm/@yume-chan/h264bsd@1.1.1/h264bsd.mjs',
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Vite 用户可以用 `?worker`:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
import SoftWorker from './soft-worker?worker';
|
|
44
|
+
softDecode: { worker: () => new SoftWorker(), modules: { ... } }
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## 更完整的示例
|
|
48
|
+
|
|
49
|
+
`demo/` 是完整演示页(协议预设、解码器切换、统计面板、静音、WASM 软解):
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm run dev
|
|
53
|
+
```
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
|
+
<title>FluxKit minimal example</title>
|
|
7
|
+
<style>
|
|
8
|
+
body { margin: 0; padding: 24px; background: #0b0e14; color: #e7ecf5; font: 14px/1.5 system-ui, sans-serif; }
|
|
9
|
+
.row { display: flex; gap: 8px; margin-bottom: 16px; }
|
|
10
|
+
input { flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid #2a3446; background: #121722; color: inherit; }
|
|
11
|
+
button { padding: 8px 16px; border-radius: 8px; border: 0; background: #5b8cff; color: #fff; cursor: pointer; }
|
|
12
|
+
#stage { width: min(960px, 100%); aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; }
|
|
13
|
+
</style>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class="row">
|
|
17
|
+
<input id="url" spellcheck="false"
|
|
18
|
+
value="https://sf1-cdn-tos.huoshanstatic.com/obj/media-fe/xgplayer_doc_video/flv/xgplayer-demo-360p.flv" />
|
|
19
|
+
<button id="load">播放</button>
|
|
20
|
+
</div>
|
|
21
|
+
<div id="stage"></div>
|
|
22
|
+
|
|
23
|
+
<!-- 发布后可直接用 CDN;本地开发改成 ../dist/fluxkit.umd.cjs -->
|
|
24
|
+
<script src="https://unpkg.com/fluxkit-player/dist/fluxkit.umd.cjs"></script>
|
|
25
|
+
<script>
|
|
26
|
+
const { FluxKit } = window.FluxKit;
|
|
27
|
+
const player = new FluxKit('#stage', {
|
|
28
|
+
decoder: 'auto',
|
|
29
|
+
autoplay: true,
|
|
30
|
+
muted: true,
|
|
31
|
+
logLevel: 'info',
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
player.on('stats', (s) => {
|
|
35
|
+
document.title = `${s.protocol} / ${s.decoder} / ${s.fps}fps`;
|
|
36
|
+
});
|
|
37
|
+
player.on('error', (err) => {
|
|
38
|
+
alert(err.code ? `${err.code}: ${err.message}` : err.message);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
document.querySelector('#load').addEventListener('click', () => {
|
|
42
|
+
const url = document.querySelector('#url').value.trim();
|
|
43
|
+
if (url) player.load(url).catch(console.error);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
player.load(document.querySelector('#url').value).catch(console.error);
|
|
47
|
+
</script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import type { CSSProperties } from 'react';
|
|
3
|
+
import { FluxKit, type FluxKitOptions } from 'fluxkit-player';
|
|
4
|
+
|
|
5
|
+
export interface FluxPlayerProps {
|
|
6
|
+
src: string;
|
|
7
|
+
/** Pass decoder/hls/softDecode etc. Keep the object stable (useMemo). */
|
|
8
|
+
options?: FluxKitOptions;
|
|
9
|
+
className?: string;
|
|
10
|
+
style?: CSSProperties;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Minimal React wrapper.
|
|
15
|
+
*
|
|
16
|
+
* <FluxPlayer src="https://example.com/live/room1.flv" />
|
|
17
|
+
*/
|
|
18
|
+
export function FluxPlayer({ src, options, className, style }: FluxPlayerProps) {
|
|
19
|
+
const stage = useRef<HTMLDivElement>(null);
|
|
20
|
+
const player = useRef<FluxKit | null>(null);
|
|
21
|
+
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!stage.current) return;
|
|
24
|
+
|
|
25
|
+
const instance = new FluxKit(stage.current, {
|
|
26
|
+
autoplay: true,
|
|
27
|
+
muted: true,
|
|
28
|
+
...options,
|
|
29
|
+
});
|
|
30
|
+
player.current = instance;
|
|
31
|
+
|
|
32
|
+
instance.on('error', (err) => console.error('[fluxkit]', err));
|
|
33
|
+
void instance.load(src).catch(console.error);
|
|
34
|
+
|
|
35
|
+
return () => {
|
|
36
|
+
instance.destroy();
|
|
37
|
+
player.current = null;
|
|
38
|
+
};
|
|
39
|
+
}, [src]);
|
|
40
|
+
|
|
41
|
+
return (
|
|
42
|
+
<div
|
|
43
|
+
ref={stage}
|
|
44
|
+
className={className}
|
|
45
|
+
style={{ width: '100%', aspectRatio: '16 / 9', background: '#000', ...style }}
|
|
46
|
+
/>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
3
|
+
import { FluxKit, type FluxKitOptions } from 'fluxkit-player';
|
|
4
|
+
|
|
5
|
+
const props = defineProps<{
|
|
6
|
+
src: string;
|
|
7
|
+
options?: FluxKitOptions;
|
|
8
|
+
}>();
|
|
9
|
+
|
|
10
|
+
const el = ref<HTMLDivElement>();
|
|
11
|
+
let player: FluxKit | null = null;
|
|
12
|
+
|
|
13
|
+
onMounted(() => {
|
|
14
|
+
if (!el.value) return;
|
|
15
|
+
player = new FluxKit(el.value, {
|
|
16
|
+
autoplay: true,
|
|
17
|
+
muted: true,
|
|
18
|
+
...props.options,
|
|
19
|
+
});
|
|
20
|
+
player.on('error', (err) => console.error('[fluxkit]', err));
|
|
21
|
+
void player.load(props.src).catch(console.error);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
watch(
|
|
25
|
+
() => props.src,
|
|
26
|
+
(src) => {
|
|
27
|
+
if (player) void player.load(src).catch(console.error);
|
|
28
|
+
},
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
onBeforeUnmount(() => {
|
|
32
|
+
player?.destroy();
|
|
33
|
+
player = null;
|
|
34
|
+
});
|
|
35
|
+
</script>
|
|
36
|
+
|
|
37
|
+
<template>
|
|
38
|
+
<div ref="el" class="flux-player" />
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<style scoped>
|
|
42
|
+
.flux-player {
|
|
43
|
+
width: 100%;
|
|
44
|
+
aspect-ratio: 16 / 9;
|
|
45
|
+
background: #000;
|
|
46
|
+
}
|
|
47
|
+
</style>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fluxkit-player",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "One player for every stream — H.264/H.265 hardware-accelerated playback plus WASM software fallback for HTTP-FLV, WS-FLV, MP4, HTTP-FMP4 and HLS on the web.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"video",
|
|
@@ -34,8 +34,12 @@
|
|
|
34
34
|
},
|
|
35
35
|
"files": [
|
|
36
36
|
"dist",
|
|
37
|
+
"docs",
|
|
38
|
+
"examples",
|
|
37
39
|
"README.md",
|
|
40
|
+
"README.en.md",
|
|
38
41
|
"CHANGELOG.md",
|
|
42
|
+
"THIRD-PARTY-NOTICES.md",
|
|
39
43
|
"LICENSE"
|
|
40
44
|
],
|
|
41
45
|
"sideEffects": false,
|
|
@@ -47,17 +51,28 @@
|
|
|
47
51
|
"test:watch": "vitest",
|
|
48
52
|
"test:e2e": "npm run build && node e2e/run.mjs",
|
|
49
53
|
"preview": "vite preview",
|
|
50
|
-
"prepublishOnly": "npm run typecheck && npm run test && npm run build"
|
|
54
|
+
"prepublishOnly": "npm run typecheck && npm run test && npm run build",
|
|
55
|
+
"lint": "eslint src test",
|
|
56
|
+
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\" \"demo/**/*.{ts,css,html}\" \"e2e/**/*.{mjs,html}\" \"*.{ts,js,json}\"",
|
|
57
|
+
"format:check": "prettier --check \"src/**/*.ts\" \"test/**/*.ts\" \"demo/**/*.{ts,css,html}\" \"e2e/**/*.{mjs,html}\" \"*.{ts,js,json}\"",
|
|
58
|
+
"test:coverage": "vitest run --coverage",
|
|
59
|
+
"test:e2e:firefox": "npm run build && node e2e/run.mjs --browser=firefox"
|
|
51
60
|
},
|
|
52
61
|
"publishConfig": {
|
|
53
62
|
"access": "public",
|
|
54
63
|
"registry": "https://registry.npmjs.org"
|
|
55
64
|
},
|
|
56
65
|
"devDependencies": {
|
|
66
|
+
"@enaium/openh264-kmp": "^1.0.1-fixed.2.7.0",
|
|
57
67
|
"@types/node": "^26.6.11",
|
|
68
|
+
"@vitest/coverage-v8": "^5.1.2",
|
|
58
69
|
"@yume-chan/h264bsd": "^1.1.1",
|
|
59
70
|
"@yume-chan/libde265": "^1.0.0",
|
|
71
|
+
"eslint": "^10.15.0",
|
|
72
|
+
"eslint-config-prettier": "^10.1.8",
|
|
73
|
+
"prettier": "^3.10.1",
|
|
60
74
|
"typescript": "^5.9.3",
|
|
75
|
+
"typescript-eslint": "^8.74.0",
|
|
61
76
|
"vite": "^8.3.8",
|
|
62
77
|
"vitest": "^5.1.2"
|
|
63
78
|
},
|
|
@@ -66,7 +81,8 @@
|
|
|
66
81
|
},
|
|
67
82
|
"peerDependencies": {
|
|
68
83
|
"@yume-chan/h264bsd": "^1.1.0",
|
|
69
|
-
"@yume-chan/libde265": "^1.0.0"
|
|
84
|
+
"@yume-chan/libde265": "^1.0.0",
|
|
85
|
+
"@enaium/openh264-kmp": "^1.0.1-fixed.2.7.0"
|
|
70
86
|
},
|
|
71
87
|
"peerDependenciesMeta": {
|
|
72
88
|
"@yume-chan/libde265": {
|
|
@@ -74,6 +90,9 @@
|
|
|
74
90
|
},
|
|
75
91
|
"@yume-chan/h264bsd": {
|
|
76
92
|
"optional": true
|
|
93
|
+
},
|
|
94
|
+
"@enaium/openh264-kmp": {
|
|
95
|
+
"optional": true
|
|
77
96
|
}
|
|
78
97
|
}
|
|
79
98
|
}
|