@lox-audioserver/node-slimproto 0.1.1 → 0.1.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/client.js CHANGED
@@ -296,12 +296,15 @@ export class SlimClient {
296
296
  '\r\n', 'ascii');
297
297
  this._autoPlay = autostart;
298
298
  const isSyncGroup = parsed.searchParams.has('sync') && parsed.searchParams.has('expect');
299
+ const expectCount = isSyncGroup ? Number(parsed.searchParams.get('expect') ?? '0') : 0;
299
300
  // For sync-groups we want BUFFER_READY quickly so we can do coordinated unpause.
300
301
  // With MP3 @ 256kbps, 200KB threshold can take ~6s to fill; lowering keeps groups snappy.
301
- const thresholdKb = isSyncGroup ? 64 : 200;
302
+ const thresholdKb = isSyncGroup ? (expectCount === 1 ? 32 : 64) : 200;
302
303
  // For sync-groups we prefer a bit more output buffer to avoid early underruns,
303
304
  // especially with lossless streams or weaker WiFi links.
304
- const outputThreshold = isSyncGroup ? 50 : 20;
305
+ // However, `expect=1` is also used for single-player "alert" playback, where startup
306
+ // latency matters more than underrun protection. Keep output buffering near zero there.
307
+ const outputThreshold = isSyncGroup ? (expectCount === 1 ? 0 : 50) : 20;
305
308
  await this.sendStrm({
306
309
  command: 's',
307
310
  codecDetails,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lox-audioserver/node-slimproto",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "SlimProto server/client utilities for controlling Squeezebox-compatible players in Node.js.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/src/client.ts CHANGED
@@ -383,12 +383,15 @@ export class SlimClient {
383
383
  this._autoPlay = autostart;
384
384
 
385
385
  const isSyncGroup = parsed.searchParams.has('sync') && parsed.searchParams.has('expect');
386
+ const expectCount = isSyncGroup ? Number(parsed.searchParams.get('expect') ?? '0') : 0;
386
387
  // For sync-groups we want BUFFER_READY quickly so we can do coordinated unpause.
387
388
  // With MP3 @ 256kbps, 200KB threshold can take ~6s to fill; lowering keeps groups snappy.
388
- const thresholdKb = isSyncGroup ? 64 : 200;
389
+ const thresholdKb = isSyncGroup ? (expectCount === 1 ? 32 : 64) : 200;
389
390
  // For sync-groups we prefer a bit more output buffer to avoid early underruns,
390
391
  // especially with lossless streams or weaker WiFi links.
391
- const outputThreshold = isSyncGroup ? 50 : 20;
392
+ // However, `expect=1` is also used for single-player "alert" playback, where startup
393
+ // latency matters more than underrun protection. Keep output buffering near zero there.
394
+ const outputThreshold = isSyncGroup ? (expectCount === 1 ? 0 : 50) : 20;
392
395
 
393
396
  await this.sendStrm({
394
397
  command: 's',