diff options
| author | Adam Soltys <[email protected]> | 2026-10-19 00:43:48 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-10-19 00:43:48 -0700 |
| commit | debbfaa1f0173d5be08fe40c27b12764f18d41ad (patch) | |
| tree | d8ac1561c54b4f5dac5014b748feb481e94700cb | |
| parent | 07fb145efbc32cdfe2dc488c65d8708260f6f648 (diff) | |
| download | coinosv3-server-debbfaa1f0173d5be08fe40c27b12764f18d41ad.tar.gz coinosv3-server-debbfaa1f0173d5be08fe40c27b12764f18d41ad.zip | |
live: 1 s HLS segments (keyframes every second), 10 in the live window — a player starts about three segments behind the edge, so most of a viewer's delay was the 2 s segments (8.6 s behind the broadcaster, measured; 4.5 s with these).
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_013ZDf1cyCQLkfjftYhymZAg
| -rw-r--r-- | live/server.js | 6 | ||||
| -rw-r--r-- | tools/live-ingest-test.js | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/live/server.js b/live/server.js index 3238574..9bba15c 100644 --- a/live/server.js +++ b/live/server.js @@ -84,8 +84,10 @@ const ADMINS = Array.isArray(CONFIG.admins) ? CONFIG.admins : ['98ae4da926c471c2 const ALERT_SK = /^[0-9a-f]{64}$/.test(CONFIG.alertSk || '') ? Uint8Array.from(Buffer.from(CONFIG.alertSk, 'hex')) : null; const NAME_MIN_AGE = +(process.env.LIVE_NAME_MIN_AGE_H || 24) * 3600_000; const DM_RELAYS = ['wss://relay.coinos.io', 'wss://relay.damus.io', 'wss://nos.lol']; -const WINDOW = 8; // segments in the live playlist -const SEG = 2; // seconds a segment +const WINDOW = 10; // segments in the live playlist +// seconds a segment: a player starts about three segments behind the live +// edge, so this is most of a viewer's delay (2 s segments: 8.6 s behind) +const SEG = 1; mkdirSync(DATA, { recursive: true }); const REMOVED = `${DATA}/.removed`; diff --git a/tools/live-ingest-test.js b/tools/live-ingest-test.js index c760679..3af0456 100644 --- a/tools/live-ingest-test.js +++ b/tools/live-ingest-test.js @@ -112,7 +112,7 @@ try { const done = await text(`${HTTP}/${id}/index.m3u8`); check('ending closes the playlist: the recording', /ENDLIST/.test(done.body) && /PLAYLIST-TYPE:VOD/.test(done.body)); check('...the live one ends too', /ENDLIST/.test((await text(`${HTTP}/${id}/live.m3u8`)).body)); - const total = segs(done.body).length * 2; + const total = Math.round([...done.body.matchAll(/#EXTINF:([\d.]+)/g)].reduce((n, m) => n + +m[1], 0)); check('...about the length sent (12 s + 7 s)', total >= 14 && total <= 24, total + ' s'); check('a stream that never was: 404', (await fetch(`${HTTP}/0123456789abcdef/live.m3u8`)).status === 404); const c = await connect(`auth=${auth(SK)}&name=alice`); |
