@oddin-gg/havik-player 2.23.2 → 2.23.4

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
@@ -346,7 +346,9 @@ export declare interface CreatePlayerOptions {
346
346
  * rejoins automatically (see {@link rejoinOnLive}). Default: true — and
347
347
  * fully graceful: if the endpoint is unreachable the subscription retries
348
348
  * quietly in the background while the HLS staleness watchdog remains the
349
- * layer-fallback, so playback is never affected. Set false to disable.
349
+ * layer-fallback, so playback is never affected. An HTTP 410 (the match is
350
+ * gone) stops it, a 404 (not in the catalog) slows it to one retry every
351
+ * 5 min; either way one `warning` event. Set false to disable.
350
352
  */
351
353
  liveStateEvents?: boolean;
352
354
  /**
@@ -818,6 +820,26 @@ export declare interface LiveStateEvent {
818
820
  serverTime: string;
819
821
  }
820
822
 
823
+ /**
824
+ * The HTTP answer a subscribe attempt got instead of a stream.
825
+ *
826
+ * - `terminal` (410): the match is over and gone for good; the subscription
827
+ * stops instead of reconnecting every backoff period for as long as the
828
+ * page stays open.
829
+ * - 404: the match is not in the catalog NOW — it ended and was dropped, or
830
+ * it is not listed yet (a URN known to the integrator before Bragi lists
831
+ * it). The second case heals on its own, so a 404 keeps retrying, but on
832
+ * the slow lane ({@link SubscribeLiveStateOptions.notFoundRetryMs}, 5 min)
833
+ * instead of the 15 s backoff cap: a finished match costs a request every
834
+ * five minutes, not 240 an hour.
835
+ * - anything else retries with the normal backoff.
836
+ */
837
+ export declare class LiveStateHttpError extends Error {
838
+ readonly status: number;
839
+ readonly terminal: boolean;
840
+ constructor(status: number);
841
+ }
842
+
821
843
  export declare interface LiveStateSubscription {
822
844
  /** Stop the subscription and abort the in-flight request. Idempotent. */
823
845
  close(): void;
@@ -1004,7 +1026,11 @@ export declare interface PlaybackStats {
1004
1026
  isLive?: boolean;
1005
1027
  /** Whether playback is at/near the live edge (within the live sync window). */
1006
1028
  atLiveEdge?: boolean;
1007
- /** Cumulative media segment bytes fetched this session (hls.js engine only). */
1029
+ /** Cumulative media segment bytes fetched this session (hls.js engine only):
1030
+ * each media request's own bytes, on LL-HLS a part's, otherwise a fragment's.
1031
+ * (Earlier hls.js-engine releases added the fragment's running total on
1032
+ * every part load on LL-HLS, so their readings are inflated and not
1033
+ * comparable.) */
1008
1034
  bytesLoaded?: number;
1009
1035
  /** Cumulative manifest/playlist bytes fetched this session (hls.js engine only). */
1010
1036
  playlistBytesLoaded?: number;
@@ -1270,7 +1296,11 @@ export declare interface StreamDescriptor {
1270
1296
  * The body is a `text/event-stream` we parse incrementally. The connection is
1271
1297
  * long-lived (the server caps it at ~30min and sends heartbeats); on any
1272
1298
  * close/error the client reconnects with exponential backoff and re-syncs from
1273
- * the initial snapshot the server replays on connect. A connection that stops
1299
+ * the initial snapshot the server replays on connect. Two answers are special:
1300
+ * a 410 (the match is gone for good) ends the subscription, and a 404 (not in
1301
+ * the catalog now) moves the retry to a slow lane, `notFoundRetryMs` — a tab
1302
+ * left open on a finished match used to hit the endpoint every backoff period
1303
+ * indefinitely, while a match listed late still gets picked up. A connection that stops
1274
1304
  * delivering without closing is caught by the idle watchdog
1275
1305
  * (`idleTimeoutMs`) — see the note on it in `readStream`. A subscription
1276
1306
  * failure is always non-fatal to playback — callers keep the HLS staleness
@@ -1286,9 +1316,11 @@ export declare interface SubscribeLiveStateOptions {
1286
1316
  /** Fired for the initial snapshot on connect and every subsequent transition. */
1287
1317
  onState: (ev: LiveStateEvent) => void;
1288
1318
  /**
1289
- * Fired on a non-fatal subscription problem (network drop, HTTP error,
1290
- * server lifetime-cap close). The client keeps retrying with backoff; this
1291
- * is observational only — it never tears playback down.
1319
+ * Fired on a subscription problem (network drop, HTTP error, server
1320
+ * lifetime-cap close). The client keeps retrying with backoff — a 404 on the
1321
+ * slow lane ({@link notFoundRetryMs}), and not at all after a 410
1322
+ * ({@link LiveStateHttpError} with `terminal: true`). Observational only —
1323
+ * it never tears playback down.
1292
1324
  */
1293
1325
  onError?: (err: unknown) => void;
1294
1326
  /**
@@ -1300,6 +1332,13 @@ export declare interface SubscribeLiveStateOptions {
1300
1332
  /** Reconnect backoff floor / ceiling (ms). Defaults: 1000 / 15000. */
1301
1333
  minBackoffMs?: number;
1302
1334
  maxBackoffMs?: number;
1335
+ /**
1336
+ * Retry interval after an HTTP 404 (match not in the catalog). Default
1337
+ * 300000 (5 min): long enough that a tab left open on a finished match is
1338
+ * noise, short enough that a match listed late is picked up without a
1339
+ * reload. Not floored by `maxBackoffMs`.
1340
+ */
1341
+ notFoundRetryMs?: number;
1303
1342
  /**
1304
1343
  * How long a request may stay silent before it is treated as dead and
1305
1344
  * reconnected. Applies to both phases: waiting for response headers, and
package/dist/index.d.ts CHANGED
@@ -346,7 +346,9 @@ export declare interface CreatePlayerOptions {
346
346
  * rejoins automatically (see {@link rejoinOnLive}). Default: true — and
347
347
  * fully graceful: if the endpoint is unreachable the subscription retries
348
348
  * quietly in the background while the HLS staleness watchdog remains the
349
- * layer-fallback, so playback is never affected. Set false to disable.
349
+ * layer-fallback, so playback is never affected. An HTTP 410 (the match is
350
+ * gone) stops it, a 404 (not in the catalog) slows it to one retry every
351
+ * 5 min; either way one `warning` event. Set false to disable.
350
352
  */
351
353
  liveStateEvents?: boolean;
352
354
  /**
@@ -818,6 +820,26 @@ export declare interface LiveStateEvent {
818
820
  serverTime: string;
819
821
  }
820
822
 
823
+ /**
824
+ * The HTTP answer a subscribe attempt got instead of a stream.
825
+ *
826
+ * - `terminal` (410): the match is over and gone for good; the subscription
827
+ * stops instead of reconnecting every backoff period for as long as the
828
+ * page stays open.
829
+ * - 404: the match is not in the catalog NOW — it ended and was dropped, or
830
+ * it is not listed yet (a URN known to the integrator before Bragi lists
831
+ * it). The second case heals on its own, so a 404 keeps retrying, but on
832
+ * the slow lane ({@link SubscribeLiveStateOptions.notFoundRetryMs}, 5 min)
833
+ * instead of the 15 s backoff cap: a finished match costs a request every
834
+ * five minutes, not 240 an hour.
835
+ * - anything else retries with the normal backoff.
836
+ */
837
+ export declare class LiveStateHttpError extends Error {
838
+ readonly status: number;
839
+ readonly terminal: boolean;
840
+ constructor(status: number);
841
+ }
842
+
821
843
  export declare interface LiveStateSubscription {
822
844
  /** Stop the subscription and abort the in-flight request. Idempotent. */
823
845
  close(): void;
@@ -1004,7 +1026,11 @@ export declare interface PlaybackStats {
1004
1026
  isLive?: boolean;
1005
1027
  /** Whether playback is at/near the live edge (within the live sync window). */
1006
1028
  atLiveEdge?: boolean;
1007
- /** Cumulative media segment bytes fetched this session (hls.js engine only). */
1029
+ /** Cumulative media segment bytes fetched this session (hls.js engine only):
1030
+ * each media request's own bytes, on LL-HLS a part's, otherwise a fragment's.
1031
+ * (Earlier hls.js-engine releases added the fragment's running total on
1032
+ * every part load on LL-HLS, so their readings are inflated and not
1033
+ * comparable.) */
1008
1034
  bytesLoaded?: number;
1009
1035
  /** Cumulative manifest/playlist bytes fetched this session (hls.js engine only). */
1010
1036
  playlistBytesLoaded?: number;
@@ -1270,7 +1296,11 @@ export declare interface StreamDescriptor {
1270
1296
  * The body is a `text/event-stream` we parse incrementally. The connection is
1271
1297
  * long-lived (the server caps it at ~30min and sends heartbeats); on any
1272
1298
  * close/error the client reconnects with exponential backoff and re-syncs from
1273
- * the initial snapshot the server replays on connect. A connection that stops
1299
+ * the initial snapshot the server replays on connect. Two answers are special:
1300
+ * a 410 (the match is gone for good) ends the subscription, and a 404 (not in
1301
+ * the catalog now) moves the retry to a slow lane, `notFoundRetryMs` — a tab
1302
+ * left open on a finished match used to hit the endpoint every backoff period
1303
+ * indefinitely, while a match listed late still gets picked up. A connection that stops
1274
1304
  * delivering without closing is caught by the idle watchdog
1275
1305
  * (`idleTimeoutMs`) — see the note on it in `readStream`. A subscription
1276
1306
  * failure is always non-fatal to playback — callers keep the HLS staleness
@@ -1286,9 +1316,11 @@ export declare interface SubscribeLiveStateOptions {
1286
1316
  /** Fired for the initial snapshot on connect and every subsequent transition. */
1287
1317
  onState: (ev: LiveStateEvent) => void;
1288
1318
  /**
1289
- * Fired on a non-fatal subscription problem (network drop, HTTP error,
1290
- * server lifetime-cap close). The client keeps retrying with backoff; this
1291
- * is observational only — it never tears playback down.
1319
+ * Fired on a subscription problem (network drop, HTTP error, server
1320
+ * lifetime-cap close). The client keeps retrying with backoff — a 404 on the
1321
+ * slow lane ({@link notFoundRetryMs}), and not at all after a 410
1322
+ * ({@link LiveStateHttpError} with `terminal: true`). Observational only —
1323
+ * it never tears playback down.
1292
1324
  */
1293
1325
  onError?: (err: unknown) => void;
1294
1326
  /**
@@ -1300,6 +1332,13 @@ export declare interface SubscribeLiveStateOptions {
1300
1332
  /** Reconnect backoff floor / ceiling (ms). Defaults: 1000 / 15000. */
1301
1333
  minBackoffMs?: number;
1302
1334
  maxBackoffMs?: number;
1335
+ /**
1336
+ * Retry interval after an HTTP 404 (match not in the catalog). Default
1337
+ * 300000 (5 min): long enough that a tab left open on a finished match is
1338
+ * noise, short enough that a match listed late is picked up without a
1339
+ * reload. Not floored by `maxBackoffMs`.
1340
+ */
1341
+ notFoundRetryMs?: number;
1303
1342
  /**
1304
1343
  * How long a request may stay silent before it is treated as dead and
1305
1344
  * reconnected. Applies to both phases: waiting for response headers, and