@oddin-gg/havik-player 2.23.3 → 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/havik-player.global.js +19 -19
- package/dist/havik-player.global.js.map +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -5
- package/dist/index.d.ts +40 -5
- package/dist/index.js +436 -420
- package/dist/index.js.map +1 -1
- package/docs/API.md +20 -12
- package/embed/index.html +1 -1
- package/examples/vanilla.html +1 -1
- package/package.json +1 -1
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.
|
|
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;
|
|
@@ -1274,7 +1296,11 @@ export declare interface StreamDescriptor {
|
|
|
1274
1296
|
* The body is a `text/event-stream` we parse incrementally. The connection is
|
|
1275
1297
|
* long-lived (the server caps it at ~30min and sends heartbeats); on any
|
|
1276
1298
|
* close/error the client reconnects with exponential backoff and re-syncs from
|
|
1277
|
-
* the initial snapshot the server replays on connect.
|
|
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
|
|
1278
1304
|
* delivering without closing is caught by the idle watchdog
|
|
1279
1305
|
* (`idleTimeoutMs`) — see the note on it in `readStream`. A subscription
|
|
1280
1306
|
* failure is always non-fatal to playback — callers keep the HLS staleness
|
|
@@ -1290,9 +1316,11 @@ export declare interface SubscribeLiveStateOptions {
|
|
|
1290
1316
|
/** Fired for the initial snapshot on connect and every subsequent transition. */
|
|
1291
1317
|
onState: (ev: LiveStateEvent) => void;
|
|
1292
1318
|
/**
|
|
1293
|
-
* Fired on a
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
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.
|
|
1296
1324
|
*/
|
|
1297
1325
|
onError?: (err: unknown) => void;
|
|
1298
1326
|
/**
|
|
@@ -1304,6 +1332,13 @@ export declare interface SubscribeLiveStateOptions {
|
|
|
1304
1332
|
/** Reconnect backoff floor / ceiling (ms). Defaults: 1000 / 15000. */
|
|
1305
1333
|
minBackoffMs?: number;
|
|
1306
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;
|
|
1307
1342
|
/**
|
|
1308
1343
|
* How long a request may stay silent before it is treated as dead and
|
|
1309
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.
|
|
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;
|
|
@@ -1274,7 +1296,11 @@ export declare interface StreamDescriptor {
|
|
|
1274
1296
|
* The body is a `text/event-stream` we parse incrementally. The connection is
|
|
1275
1297
|
* long-lived (the server caps it at ~30min and sends heartbeats); on any
|
|
1276
1298
|
* close/error the client reconnects with exponential backoff and re-syncs from
|
|
1277
|
-
* the initial snapshot the server replays on connect.
|
|
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
|
|
1278
1304
|
* delivering without closing is caught by the idle watchdog
|
|
1279
1305
|
* (`idleTimeoutMs`) — see the note on it in `readStream`. A subscription
|
|
1280
1306
|
* failure is always non-fatal to playback — callers keep the HLS staleness
|
|
@@ -1290,9 +1316,11 @@ export declare interface SubscribeLiveStateOptions {
|
|
|
1290
1316
|
/** Fired for the initial snapshot on connect and every subsequent transition. */
|
|
1291
1317
|
onState: (ev: LiveStateEvent) => void;
|
|
1292
1318
|
/**
|
|
1293
|
-
* Fired on a
|
|
1294
|
-
*
|
|
1295
|
-
*
|
|
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.
|
|
1296
1324
|
*/
|
|
1297
1325
|
onError?: (err: unknown) => void;
|
|
1298
1326
|
/**
|
|
@@ -1304,6 +1332,13 @@ export declare interface SubscribeLiveStateOptions {
|
|
|
1304
1332
|
/** Reconnect backoff floor / ceiling (ms). Defaults: 1000 / 15000. */
|
|
1305
1333
|
minBackoffMs?: number;
|
|
1306
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;
|
|
1307
1342
|
/**
|
|
1308
1343
|
* How long a request may stay silent before it is treated as dead and
|
|
1309
1344
|
* reconnected. Applies to both phases: waiting for response headers, and
|