@oddin-gg/havik-player 1.14.0 → 1.15.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/havik-player.global.js +3 -3
- 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 +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -1
- package/embed/index.html +1 -1
- package/examples/vanilla.html +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -164,6 +164,16 @@ export declare interface CreatePlayerOptions {
|
|
|
164
164
|
* differs from that convention.
|
|
165
165
|
*/
|
|
166
166
|
eventsBaseUrl?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Extra headers attached to every request the SDK makes to {@link baseUrl}
|
|
169
|
+
* (playback resolution, live-status polling) — and ONLY there: never to
|
|
170
|
+
* CDN manifest/segment hosts, DRM license endpoints, the SSE events host,
|
|
171
|
+
* or the beacons endpoint. For integrations whose API front door wants
|
|
172
|
+
* its own auth signal on top of the publishable key — an operator console
|
|
173
|
+
* proving a session to its reverse proxy, or a customer gateway in front
|
|
174
|
+
* of the streams API. `x-api-key` cannot be overridden through this map.
|
|
175
|
+
*/
|
|
176
|
+
apiHeaders?: Record<string, string>;
|
|
167
177
|
/**
|
|
168
178
|
* QoE beacons + CMCD session attribution. Active only when the playback
|
|
169
179
|
* response carries an analytics sid (the server-side flag) — without one
|
|
@@ -295,6 +305,11 @@ export declare interface FetchCatalogOptions {
|
|
|
295
305
|
etag?: string;
|
|
296
306
|
status?: MatchLiveStatus | MatchLiveStatus[];
|
|
297
307
|
sport?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Extra headers attached to every request to {@link baseUrl} — and only
|
|
310
|
+
* there: never to CDN or license hosts. `x-api-key` cannot be overridden.
|
|
311
|
+
*/
|
|
312
|
+
apiHeaders?: Record<string, string>;
|
|
298
313
|
}
|
|
299
314
|
|
|
300
315
|
/**
|
|
@@ -315,6 +330,11 @@ export declare interface FetchTournamentOptions {
|
|
|
315
330
|
signal?: AbortSignal;
|
|
316
331
|
/** Prior ETag for a conditional GET (304 when unchanged) — only effective once havik-streams ETags `/v1/tournaments/{urn}` (parity with `/v1/matches/{urn}`). */
|
|
317
332
|
etag?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Extra headers attached to every request to {@link baseUrl} — and only
|
|
335
|
+
* there: never to CDN or license hosts. `x-api-key` cannot be overridden.
|
|
336
|
+
*/
|
|
337
|
+
apiHeaders?: Record<string, string>;
|
|
318
338
|
}
|
|
319
339
|
|
|
320
340
|
/** Flatten a Catalog to a single match list (handy for grids). */
|
|
@@ -687,6 +707,14 @@ export declare interface ResolveOptions {
|
|
|
687
707
|
*/
|
|
688
708
|
waitForLive?: WaitForLive;
|
|
689
709
|
signal?: AbortSignal;
|
|
710
|
+
/**
|
|
711
|
+
* Extra headers attached to every request this call makes to {@link baseUrl}
|
|
712
|
+
* — and ONLY there: never to CDN manifest/segment hosts or DRM license
|
|
713
|
+
* endpoints. For integrations whose API front door wants its own auth
|
|
714
|
+
* signal on top of the publishable key (gateways, operator consoles).
|
|
715
|
+
* `x-api-key` cannot be overridden.
|
|
716
|
+
*/
|
|
717
|
+
apiHeaders?: Record<string, string>;
|
|
690
718
|
}
|
|
691
719
|
|
|
692
720
|
/**
|
|
@@ -870,6 +898,11 @@ export declare interface WatchStatusOptions {
|
|
|
870
898
|
onError?: (err: PlaybackError) => void;
|
|
871
899
|
/** Poll interval in ms. Floored at 2000. Default: 10000 (catalog max-age). */
|
|
872
900
|
intervalMs?: number;
|
|
901
|
+
/**
|
|
902
|
+
* Extra headers attached to every request to {@link baseUrl} — and only
|
|
903
|
+
* there: never to CDN or license hosts. `x-api-key` cannot be overridden.
|
|
904
|
+
*/
|
|
905
|
+
apiHeaders?: Record<string, string>;
|
|
873
906
|
}
|
|
874
907
|
|
|
875
908
|
export declare interface WidevineInfo {
|
package/dist/index.d.ts
CHANGED
|
@@ -164,6 +164,16 @@ export declare interface CreatePlayerOptions {
|
|
|
164
164
|
* differs from that convention.
|
|
165
165
|
*/
|
|
166
166
|
eventsBaseUrl?: string;
|
|
167
|
+
/**
|
|
168
|
+
* Extra headers attached to every request the SDK makes to {@link baseUrl}
|
|
169
|
+
* (playback resolution, live-status polling) — and ONLY there: never to
|
|
170
|
+
* CDN manifest/segment hosts, DRM license endpoints, the SSE events host,
|
|
171
|
+
* or the beacons endpoint. For integrations whose API front door wants
|
|
172
|
+
* its own auth signal on top of the publishable key — an operator console
|
|
173
|
+
* proving a session to its reverse proxy, or a customer gateway in front
|
|
174
|
+
* of the streams API. `x-api-key` cannot be overridden through this map.
|
|
175
|
+
*/
|
|
176
|
+
apiHeaders?: Record<string, string>;
|
|
167
177
|
/**
|
|
168
178
|
* QoE beacons + CMCD session attribution. Active only when the playback
|
|
169
179
|
* response carries an analytics sid (the server-side flag) — without one
|
|
@@ -295,6 +305,11 @@ export declare interface FetchCatalogOptions {
|
|
|
295
305
|
etag?: string;
|
|
296
306
|
status?: MatchLiveStatus | MatchLiveStatus[];
|
|
297
307
|
sport?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Extra headers attached to every request to {@link baseUrl} — and only
|
|
310
|
+
* there: never to CDN or license hosts. `x-api-key` cannot be overridden.
|
|
311
|
+
*/
|
|
312
|
+
apiHeaders?: Record<string, string>;
|
|
298
313
|
}
|
|
299
314
|
|
|
300
315
|
/**
|
|
@@ -315,6 +330,11 @@ export declare interface FetchTournamentOptions {
|
|
|
315
330
|
signal?: AbortSignal;
|
|
316
331
|
/** Prior ETag for a conditional GET (304 when unchanged) — only effective once havik-streams ETags `/v1/tournaments/{urn}` (parity with `/v1/matches/{urn}`). */
|
|
317
332
|
etag?: string;
|
|
333
|
+
/**
|
|
334
|
+
* Extra headers attached to every request to {@link baseUrl} — and only
|
|
335
|
+
* there: never to CDN or license hosts. `x-api-key` cannot be overridden.
|
|
336
|
+
*/
|
|
337
|
+
apiHeaders?: Record<string, string>;
|
|
318
338
|
}
|
|
319
339
|
|
|
320
340
|
/** Flatten a Catalog to a single match list (handy for grids). */
|
|
@@ -687,6 +707,14 @@ export declare interface ResolveOptions {
|
|
|
687
707
|
*/
|
|
688
708
|
waitForLive?: WaitForLive;
|
|
689
709
|
signal?: AbortSignal;
|
|
710
|
+
/**
|
|
711
|
+
* Extra headers attached to every request this call makes to {@link baseUrl}
|
|
712
|
+
* — and ONLY there: never to CDN manifest/segment hosts or DRM license
|
|
713
|
+
* endpoints. For integrations whose API front door wants its own auth
|
|
714
|
+
* signal on top of the publishable key (gateways, operator consoles).
|
|
715
|
+
* `x-api-key` cannot be overridden.
|
|
716
|
+
*/
|
|
717
|
+
apiHeaders?: Record<string, string>;
|
|
690
718
|
}
|
|
691
719
|
|
|
692
720
|
/**
|
|
@@ -870,6 +898,11 @@ export declare interface WatchStatusOptions {
|
|
|
870
898
|
onError?: (err: PlaybackError) => void;
|
|
871
899
|
/** Poll interval in ms. Floored at 2000. Default: 10000 (catalog max-age). */
|
|
872
900
|
intervalMs?: number;
|
|
901
|
+
/**
|
|
902
|
+
* Extra headers attached to every request to {@link baseUrl} — and only
|
|
903
|
+
* there: never to CDN or license hosts. `x-api-key` cannot be overridden.
|
|
904
|
+
*/
|
|
905
|
+
apiHeaders?: Record<string, string>;
|
|
873
906
|
}
|
|
874
907
|
|
|
875
908
|
export declare interface WidevineInfo {
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,7 @@ function c(e) {
|
|
|
64
64
|
}
|
|
65
65
|
async function l(e, n) {
|
|
66
66
|
let r = await o(n.credential), i = n.headers ?? new Headers();
|
|
67
|
+
if (n.apiHeaders) for (let [e, t] of Object.entries(n.apiHeaders)) i.has(e) || i.set(e, t);
|
|
67
68
|
i.set("x-api-key", r.apiKey);
|
|
68
69
|
try {
|
|
69
70
|
return await fetch(e, {
|
|
@@ -171,7 +172,8 @@ async function y(e) {
|
|
|
171
172
|
if (!e.matchUrn || typeof e.matchUrn != "string") throw new t("INVALID_URN", 0, "resolveStream: a non-empty matchUrn is required");
|
|
172
173
|
let n = await l(s(e.baseUrl, `/v1/playback/${encodeURIComponent(e.matchUrn)}`), {
|
|
173
174
|
credential: e.credential,
|
|
174
|
-
signal: e.signal
|
|
175
|
+
signal: e.signal,
|
|
176
|
+
apiHeaders: e.apiHeaders
|
|
175
177
|
});
|
|
176
178
|
if (!n.ok) throw await ae(n);
|
|
177
179
|
return S(await n.json(), e.matchUrn);
|
|
@@ -247,7 +249,8 @@ async function C(e) {
|
|
|
247
249
|
let c = await l(a, {
|
|
248
250
|
credential: e.credential,
|
|
249
251
|
signal: e.signal,
|
|
250
|
-
headers: o
|
|
252
|
+
headers: o,
|
|
253
|
+
apiHeaders: e.apiHeaders
|
|
251
254
|
});
|
|
252
255
|
if (c.status === 304) return {
|
|
253
256
|
tournaments: [],
|
|
@@ -287,7 +290,8 @@ async function ce(e) {
|
|
|
287
290
|
let a = await l(r, {
|
|
288
291
|
credential: e.credential,
|
|
289
292
|
signal: e.signal,
|
|
290
|
-
headers: i
|
|
293
|
+
headers: i,
|
|
294
|
+
apiHeaders: e.apiHeaders
|
|
291
295
|
});
|
|
292
296
|
if (a.status === 304) return {
|
|
293
297
|
etag: e.etag,
|
|
@@ -339,7 +343,8 @@ function de(e) {
|
|
|
339
343
|
let u = await l(r, {
|
|
340
344
|
credential: e.credential,
|
|
341
345
|
signal: i.signal,
|
|
342
|
-
headers: a
|
|
346
|
+
headers: a,
|
|
347
|
+
apiHeaders: e.apiHeaders
|
|
343
348
|
});
|
|
344
349
|
if (u.status !== 304) {
|
|
345
350
|
if (!u.ok) throw new t(n(u.status), u.status, `match status request failed (HTTP ${u.status})`);
|
|
@@ -1316,7 +1321,7 @@ var ze = class {
|
|
|
1316
1321
|
keepalive: !0
|
|
1317
1322
|
}).catch(() => {});
|
|
1318
1323
|
}
|
|
1319
|
-
}, Be = "1.
|
|
1324
|
+
}, Be = "1.15.0", W = {
|
|
1320
1325
|
accent: "#E1B600",
|
|
1321
1326
|
accentText: "#1B1C23",
|
|
1322
1327
|
background: "#0e0f13",
|
|
@@ -1792,7 +1797,8 @@ var tt = class {
|
|
|
1792
1797
|
baseUrl: this.opts.baseUrl,
|
|
1793
1798
|
matchUrn: this.opts.matchUrn,
|
|
1794
1799
|
credential: this.opts.credential,
|
|
1795
|
-
signal: this.abort.signal
|
|
1800
|
+
signal: this.abort.signal,
|
|
1801
|
+
apiHeaders: this.opts.apiHeaders
|
|
1796
1802
|
};
|
|
1797
1803
|
}
|
|
1798
1804
|
beginArming(e, t) {
|