@oddin-gg/havik-player 2.23.3 → 2.24.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/index.d.cts CHANGED
@@ -260,6 +260,16 @@ export declare interface CreatePlayerOptions {
260
260
  * clear streams, and when `hlsConfig.fLoader` is set.
261
261
  */
262
262
  mediaDuringKey?: boolean;
263
+ /**
264
+ * Live LL-HLS (hls.js engine): fetch the part each playlist's
265
+ * EXT-X-PRELOAD-HINT names as soon as the playlist arrives, instead of
266
+ * waiting for the next playlist to list it. The origin and CDNs hold that
267
+ * request until the part exists, so a viewer far from the origin saves
268
+ * about one round trip per part. Bytes reach hls.js only when it asks for
269
+ * the part; a hinted part it never asks for is dropped. Default: false.
270
+ * Ignored when `hlsConfig.fLoader` is set.
271
+ */
272
+ preloadHints?: boolean;
263
273
  /** Force an engine; 'auto' uses the native engine for FairPlay on Apple
264
274
  * browsers and for every stream on iPhone/iPad, hls.js elsewhere wherever
265
275
  * supported, and falls back to native HLS. Default: 'auto'. */
@@ -346,7 +356,9 @@ export declare interface CreatePlayerOptions {
346
356
  * rejoins automatically (see {@link rejoinOnLive}). Default: true — and
347
357
  * fully graceful: if the endpoint is unreachable the subscription retries
348
358
  * quietly in the background while the HLS staleness watchdog remains the
349
- * layer-fallback, so playback is never affected. Set false to disable.
359
+ * layer-fallback, so playback is never affected. An HTTP 410 (the match is
360
+ * gone) stops it, a 404 (not in the catalog) slows it to one retry every
361
+ * 5 min; either way one `warning` event. Set false to disable.
350
362
  */
351
363
  liveStateEvents?: boolean;
352
364
  /**
@@ -818,6 +830,26 @@ export declare interface LiveStateEvent {
818
830
  serverTime: string;
819
831
  }
820
832
 
833
+ /**
834
+ * The HTTP answer a subscribe attempt got instead of a stream.
835
+ *
836
+ * - `terminal` (410): the match is over and gone for good; the subscription
837
+ * stops instead of reconnecting every backoff period for as long as the
838
+ * page stays open.
839
+ * - 404: the match is not in the catalog NOW — it ended and was dropped, or
840
+ * it is not listed yet (a URN known to the integrator before Bragi lists
841
+ * it). The second case heals on its own, so a 404 keeps retrying, but on
842
+ * the slow lane ({@link SubscribeLiveStateOptions.notFoundRetryMs}, 5 min)
843
+ * instead of the 15 s backoff cap: a finished match costs a request every
844
+ * five minutes, not 240 an hour.
845
+ * - anything else retries with the normal backoff.
846
+ */
847
+ export declare class LiveStateHttpError extends Error {
848
+ readonly status: number;
849
+ readonly terminal: boolean;
850
+ constructor(status: number);
851
+ }
852
+
821
853
  export declare interface LiveStateSubscription {
822
854
  /** Stop the subscription and abort the in-flight request. Idempotent. */
823
855
  close(): void;
@@ -1274,7 +1306,11 @@ export declare interface StreamDescriptor {
1274
1306
  * The body is a `text/event-stream` we parse incrementally. The connection is
1275
1307
  * long-lived (the server caps it at ~30min and sends heartbeats); on any
1276
1308
  * close/error the client reconnects with exponential backoff and re-syncs from
1277
- * the initial snapshot the server replays on connect. A connection that stops
1309
+ * the initial snapshot the server replays on connect. Two answers are special:
1310
+ * a 410 (the match is gone for good) ends the subscription, and a 404 (not in
1311
+ * the catalog now) moves the retry to a slow lane, `notFoundRetryMs` — a tab
1312
+ * left open on a finished match used to hit the endpoint every backoff period
1313
+ * indefinitely, while a match listed late still gets picked up. A connection that stops
1278
1314
  * delivering without closing is caught by the idle watchdog
1279
1315
  * (`idleTimeoutMs`) — see the note on it in `readStream`. A subscription
1280
1316
  * failure is always non-fatal to playback — callers keep the HLS staleness
@@ -1290,9 +1326,11 @@ export declare interface SubscribeLiveStateOptions {
1290
1326
  /** Fired for the initial snapshot on connect and every subsequent transition. */
1291
1327
  onState: (ev: LiveStateEvent) => void;
1292
1328
  /**
1293
- * Fired on a non-fatal subscription problem (network drop, HTTP error,
1294
- * server lifetime-cap close). The client keeps retrying with backoff; this
1295
- * is observational only — it never tears playback down.
1329
+ * Fired on a subscription problem (network drop, HTTP error, server
1330
+ * lifetime-cap close). The client keeps retrying with backoff — a 404 on the
1331
+ * slow lane ({@link notFoundRetryMs}), and not at all after a 410
1332
+ * ({@link LiveStateHttpError} with `terminal: true`). Observational only —
1333
+ * it never tears playback down.
1296
1334
  */
1297
1335
  onError?: (err: unknown) => void;
1298
1336
  /**
@@ -1304,6 +1342,13 @@ export declare interface SubscribeLiveStateOptions {
1304
1342
  /** Reconnect backoff floor / ceiling (ms). Defaults: 1000 / 15000. */
1305
1343
  minBackoffMs?: number;
1306
1344
  maxBackoffMs?: number;
1345
+ /**
1346
+ * Retry interval after an HTTP 404 (match not in the catalog). Default
1347
+ * 300000 (5 min): long enough that a tab left open on a finished match is
1348
+ * noise, short enough that a match listed late is picked up without a
1349
+ * reload. Not floored by `maxBackoffMs`.
1350
+ */
1351
+ notFoundRetryMs?: number;
1307
1352
  /**
1308
1353
  * How long a request may stay silent before it is treated as dead and
1309
1354
  * reconnected. Applies to both phases: waiting for response headers, and
package/dist/index.d.ts CHANGED
@@ -260,6 +260,16 @@ export declare interface CreatePlayerOptions {
260
260
  * clear streams, and when `hlsConfig.fLoader` is set.
261
261
  */
262
262
  mediaDuringKey?: boolean;
263
+ /**
264
+ * Live LL-HLS (hls.js engine): fetch the part each playlist's
265
+ * EXT-X-PRELOAD-HINT names as soon as the playlist arrives, instead of
266
+ * waiting for the next playlist to list it. The origin and CDNs hold that
267
+ * request until the part exists, so a viewer far from the origin saves
268
+ * about one round trip per part. Bytes reach hls.js only when it asks for
269
+ * the part; a hinted part it never asks for is dropped. Default: false.
270
+ * Ignored when `hlsConfig.fLoader` is set.
271
+ */
272
+ preloadHints?: boolean;
263
273
  /** Force an engine; 'auto' uses the native engine for FairPlay on Apple
264
274
  * browsers and for every stream on iPhone/iPad, hls.js elsewhere wherever
265
275
  * supported, and falls back to native HLS. Default: 'auto'. */
@@ -346,7 +356,9 @@ export declare interface CreatePlayerOptions {
346
356
  * rejoins automatically (see {@link rejoinOnLive}). Default: true — and
347
357
  * fully graceful: if the endpoint is unreachable the subscription retries
348
358
  * quietly in the background while the HLS staleness watchdog remains the
349
- * layer-fallback, so playback is never affected. Set false to disable.
359
+ * layer-fallback, so playback is never affected. An HTTP 410 (the match is
360
+ * gone) stops it, a 404 (not in the catalog) slows it to one retry every
361
+ * 5 min; either way one `warning` event. Set false to disable.
350
362
  */
351
363
  liveStateEvents?: boolean;
352
364
  /**
@@ -818,6 +830,26 @@ export declare interface LiveStateEvent {
818
830
  serverTime: string;
819
831
  }
820
832
 
833
+ /**
834
+ * The HTTP answer a subscribe attempt got instead of a stream.
835
+ *
836
+ * - `terminal` (410): the match is over and gone for good; the subscription
837
+ * stops instead of reconnecting every backoff period for as long as the
838
+ * page stays open.
839
+ * - 404: the match is not in the catalog NOW — it ended and was dropped, or
840
+ * it is not listed yet (a URN known to the integrator before Bragi lists
841
+ * it). The second case heals on its own, so a 404 keeps retrying, but on
842
+ * the slow lane ({@link SubscribeLiveStateOptions.notFoundRetryMs}, 5 min)
843
+ * instead of the 15 s backoff cap: a finished match costs a request every
844
+ * five minutes, not 240 an hour.
845
+ * - anything else retries with the normal backoff.
846
+ */
847
+ export declare class LiveStateHttpError extends Error {
848
+ readonly status: number;
849
+ readonly terminal: boolean;
850
+ constructor(status: number);
851
+ }
852
+
821
853
  export declare interface LiveStateSubscription {
822
854
  /** Stop the subscription and abort the in-flight request. Idempotent. */
823
855
  close(): void;
@@ -1274,7 +1306,11 @@ export declare interface StreamDescriptor {
1274
1306
  * The body is a `text/event-stream` we parse incrementally. The connection is
1275
1307
  * long-lived (the server caps it at ~30min and sends heartbeats); on any
1276
1308
  * close/error the client reconnects with exponential backoff and re-syncs from
1277
- * the initial snapshot the server replays on connect. A connection that stops
1309
+ * the initial snapshot the server replays on connect. Two answers are special:
1310
+ * a 410 (the match is gone for good) ends the subscription, and a 404 (not in
1311
+ * the catalog now) moves the retry to a slow lane, `notFoundRetryMs` — a tab
1312
+ * left open on a finished match used to hit the endpoint every backoff period
1313
+ * indefinitely, while a match listed late still gets picked up. A connection that stops
1278
1314
  * delivering without closing is caught by the idle watchdog
1279
1315
  * (`idleTimeoutMs`) — see the note on it in `readStream`. A subscription
1280
1316
  * failure is always non-fatal to playback — callers keep the HLS staleness
@@ -1290,9 +1326,11 @@ export declare interface SubscribeLiveStateOptions {
1290
1326
  /** Fired for the initial snapshot on connect and every subsequent transition. */
1291
1327
  onState: (ev: LiveStateEvent) => void;
1292
1328
  /**
1293
- * Fired on a non-fatal subscription problem (network drop, HTTP error,
1294
- * server lifetime-cap close). The client keeps retrying with backoff; this
1295
- * is observational only — it never tears playback down.
1329
+ * Fired on a subscription problem (network drop, HTTP error, server
1330
+ * lifetime-cap close). The client keeps retrying with backoff — a 404 on the
1331
+ * slow lane ({@link notFoundRetryMs}), and not at all after a 410
1332
+ * ({@link LiveStateHttpError} with `terminal: true`). Observational only —
1333
+ * it never tears playback down.
1296
1334
  */
1297
1335
  onError?: (err: unknown) => void;
1298
1336
  /**
@@ -1304,6 +1342,13 @@ export declare interface SubscribeLiveStateOptions {
1304
1342
  /** Reconnect backoff floor / ceiling (ms). Defaults: 1000 / 15000. */
1305
1343
  minBackoffMs?: number;
1306
1344
  maxBackoffMs?: number;
1345
+ /**
1346
+ * Retry interval after an HTTP 404 (match not in the catalog). Default
1347
+ * 300000 (5 min): long enough that a tab left open on a finished match is
1348
+ * noise, short enough that a match listed late is picked up without a
1349
+ * reload. Not floored by `maxBackoffMs`.
1350
+ */
1351
+ notFoundRetryMs?: number;
1307
1352
  /**
1308
1353
  * How long a request may stay silent before it is treated as dead and
1309
1354
  * reconnected. Applies to both phases: waiting for response headers, and