@oddin-gg/havik-player 2.6.4 → 2.8.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/README.md +43 -3
- package/dist/havik-player.global.js +17 -17
- 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 +79 -7
- package/dist/index.d.ts +79 -7
- package/dist/index.js +284 -233
- package/dist/index.js.map +1 -1
- package/docs/API.md +29 -2
- package/embed/index.html +1 -1
- package/examples/vanilla.html +1 -1
- package/package.json +4 -2
package/dist/index.d.cts
CHANGED
|
@@ -11,6 +11,23 @@ export declare interface AudioTrackInfo {
|
|
|
11
11
|
default: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The API base URL for a named environment.
|
|
16
|
+
*
|
|
17
|
+
* Mode A takes {@link HavikEnv} directly (`createPlayer({ env: 'production' })`).
|
|
18
|
+
* Mode B and Mode C still take a `baseUrl`, so call this to get one rather
|
|
19
|
+
* than copying a hostname into your own config:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* resolveStream({ baseUrl: baseUrlForEnv('production'), matchUrn, credential });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Throws on an unrecognized value rather than returning undefined — callers
|
|
26
|
+
* reach this from plain JS where the type gives no protection, and a silent
|
|
27
|
+
* undefined becomes a relative URL against the embedding page.
|
|
28
|
+
*/
|
|
29
|
+
export declare function baseUrlForEnv(env: HavikEnv): string;
|
|
30
|
+
|
|
14
31
|
/**
|
|
15
32
|
* Boots the iframe-side player and speaks the postMessage protocol with the host.
|
|
16
33
|
* The api-key is NEVER accepted over postMessage. The bridge fails CLOSED: with no
|
|
@@ -53,18 +70,53 @@ export declare interface CatalogTournament {
|
|
|
53
70
|
export declare function clearDeviceId(): void;
|
|
54
71
|
|
|
55
72
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
73
|
+
* Endpoint selection, enforced at COMPILE time.
|
|
74
|
+
*
|
|
75
|
+
* `env` and `baseUrl` are both optional on {@link CreatePlayerOptions} so it
|
|
76
|
+
* stays an interface others can `extend` and `Partial<>`. That alone would
|
|
77
|
+
* make "neither given" type-check and fail only in the browser, which is a
|
|
78
|
+
* guarantee this SDK used to have while `baseUrl` was required. These two
|
|
79
|
+
* overloads put it back at the call site without changing the interface: one
|
|
80
|
+
* names `env` and forbids `baseUrl`, the other the reverse, so neither and
|
|
81
|
+
* both are both "no overload matches this call".
|
|
82
|
+
*
|
|
83
|
+
* resolveEndpoint still enforces the same rule at runtime — the overloads do
|
|
84
|
+
* nothing for a JavaScript caller, and that is most of the embed surface.
|
|
61
85
|
*/
|
|
62
|
-
export declare function createPlayer(opts: CreatePlayerOptions
|
|
86
|
+
export declare function createPlayer(opts: CreatePlayerOptions & {
|
|
87
|
+
env: HavikEnv;
|
|
88
|
+
baseUrl?: never;
|
|
89
|
+
}): Promise<Player>;
|
|
90
|
+
|
|
91
|
+
export declare function createPlayer(opts: CreatePlayerOptions & {
|
|
92
|
+
baseUrl: string;
|
|
93
|
+
env?: never;
|
|
94
|
+
}): Promise<Player>;
|
|
63
95
|
|
|
64
96
|
export declare interface CreatePlayerOptions {
|
|
65
97
|
/** The <video> element the SDK will own. */
|
|
66
98
|
video: HTMLVideoElement;
|
|
67
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Which Oddin environment to play against. Prefer this over
|
|
101
|
+
* {@link baseUrl}: the host is then correct by construction, and so is
|
|
102
|
+
* everything derived from it (the SSE events host, the QoE beacons host).
|
|
103
|
+
*
|
|
104
|
+
* Exactly one of `env` or {@link baseUrl} is required. Passing both is an
|
|
105
|
+
* error rather than a precedence rule — the two disagreeing is precisely
|
|
106
|
+
* the misconfiguration worth refusing, and silently preferring one would
|
|
107
|
+
* point a player at an environment nobody chose.
|
|
108
|
+
*/
|
|
109
|
+
env?: HavikEnv;
|
|
110
|
+
/**
|
|
111
|
+
* API base URL, when {@link env} does not name it. Use this for a
|
|
112
|
+
* deployment the named environments do not cover: your own CDN or gateway
|
|
113
|
+
* fronting the streams API, the CN plane, or a pinned build that must
|
|
114
|
+
* outlive a domain change.
|
|
115
|
+
*
|
|
116
|
+
* Note that a base which is not a `feed[-dev].<domain>` host derives no QoE
|
|
117
|
+
* beacons endpoint, so pair it with `analytics: { endpoint }`.
|
|
118
|
+
*/
|
|
119
|
+
baseUrl?: string;
|
|
68
120
|
matchUrn: string;
|
|
69
121
|
credential: CredentialSource;
|
|
70
122
|
/**
|
|
@@ -231,6 +283,16 @@ export declare interface CreatePlayerOptions {
|
|
|
231
283
|
*/
|
|
232
284
|
analytics?: boolean | {
|
|
233
285
|
endpoint?: string;
|
|
286
|
+
/**
|
|
287
|
+
* How long the player may sit paused before the session closes itself
|
|
288
|
+
* (`END_REASON_IDLE`), and the suspension gap (OS sleep, a frozen tab)
|
|
289
|
+
* after which it does the same on waking. Default 10 minutes; `0`
|
|
290
|
+
* disables the idle close; the suspension gap never goes below five
|
|
291
|
+
* minutes, whatever this is set to (a hidden tab's throttled timers
|
|
292
|
+
* legitimately gap to a minute). After an idle close the next play()
|
|
293
|
+
* reloads the stream — a fresh session, a fresh sid, the live edge.
|
|
294
|
+
*/
|
|
295
|
+
idleMs?: number;
|
|
234
296
|
};
|
|
235
297
|
}
|
|
236
298
|
|
|
@@ -467,6 +529,16 @@ export declare type FrameToHost = {
|
|
|
467
529
|
|
|
468
530
|
export declare function getDeviceId(): string;
|
|
469
531
|
|
|
532
|
+
/**
|
|
533
|
+
* A named Oddin environment.
|
|
534
|
+
*
|
|
535
|
+
* - `integration` — the shared pre-production stack. Where customers build
|
|
536
|
+
* and test against real matches.
|
|
537
|
+
* - `production` — the production stack. A separate distribution, not an
|
|
538
|
+
* alias of integration.
|
|
539
|
+
*/
|
|
540
|
+
export declare type HavikEnv = 'integration' | 'production';
|
|
541
|
+
|
|
470
542
|
export declare interface HavikTheme {
|
|
471
543
|
/** Primary accent (play button, progress fill, live dot, focus). */
|
|
472
544
|
accent: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,23 @@ export declare interface AudioTrackInfo {
|
|
|
11
11
|
default: boolean;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
/**
|
|
15
|
+
* The API base URL for a named environment.
|
|
16
|
+
*
|
|
17
|
+
* Mode A takes {@link HavikEnv} directly (`createPlayer({ env: 'production' })`).
|
|
18
|
+
* Mode B and Mode C still take a `baseUrl`, so call this to get one rather
|
|
19
|
+
* than copying a hostname into your own config:
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* resolveStream({ baseUrl: baseUrlForEnv('production'), matchUrn, credential });
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* Throws on an unrecognized value rather than returning undefined — callers
|
|
26
|
+
* reach this from plain JS where the type gives no protection, and a silent
|
|
27
|
+
* undefined becomes a relative URL against the embedding page.
|
|
28
|
+
*/
|
|
29
|
+
export declare function baseUrlForEnv(env: HavikEnv): string;
|
|
30
|
+
|
|
14
31
|
/**
|
|
15
32
|
* Boots the iframe-side player and speaks the postMessage protocol with the host.
|
|
16
33
|
* The api-key is NEVER accepted over postMessage. The bridge fails CLOSED: with no
|
|
@@ -53,18 +70,53 @@ export declare interface CatalogTournament {
|
|
|
53
70
|
export declare function clearDeviceId(): void;
|
|
54
71
|
|
|
55
72
|
/**
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
73
|
+
* Endpoint selection, enforced at COMPILE time.
|
|
74
|
+
*
|
|
75
|
+
* `env` and `baseUrl` are both optional on {@link CreatePlayerOptions} so it
|
|
76
|
+
* stays an interface others can `extend` and `Partial<>`. That alone would
|
|
77
|
+
* make "neither given" type-check and fail only in the browser, which is a
|
|
78
|
+
* guarantee this SDK used to have while `baseUrl` was required. These two
|
|
79
|
+
* overloads put it back at the call site without changing the interface: one
|
|
80
|
+
* names `env` and forbids `baseUrl`, the other the reverse, so neither and
|
|
81
|
+
* both are both "no overload matches this call".
|
|
82
|
+
*
|
|
83
|
+
* resolveEndpoint still enforces the same rule at runtime — the overloads do
|
|
84
|
+
* nothing for a JavaScript caller, and that is most of the embed surface.
|
|
61
85
|
*/
|
|
62
|
-
export declare function createPlayer(opts: CreatePlayerOptions
|
|
86
|
+
export declare function createPlayer(opts: CreatePlayerOptions & {
|
|
87
|
+
env: HavikEnv;
|
|
88
|
+
baseUrl?: never;
|
|
89
|
+
}): Promise<Player>;
|
|
90
|
+
|
|
91
|
+
export declare function createPlayer(opts: CreatePlayerOptions & {
|
|
92
|
+
baseUrl: string;
|
|
93
|
+
env?: never;
|
|
94
|
+
}): Promise<Player>;
|
|
63
95
|
|
|
64
96
|
export declare interface CreatePlayerOptions {
|
|
65
97
|
/** The <video> element the SDK will own. */
|
|
66
98
|
video: HTMLVideoElement;
|
|
67
|
-
|
|
99
|
+
/**
|
|
100
|
+
* Which Oddin environment to play against. Prefer this over
|
|
101
|
+
* {@link baseUrl}: the host is then correct by construction, and so is
|
|
102
|
+
* everything derived from it (the SSE events host, the QoE beacons host).
|
|
103
|
+
*
|
|
104
|
+
* Exactly one of `env` or {@link baseUrl} is required. Passing both is an
|
|
105
|
+
* error rather than a precedence rule — the two disagreeing is precisely
|
|
106
|
+
* the misconfiguration worth refusing, and silently preferring one would
|
|
107
|
+
* point a player at an environment nobody chose.
|
|
108
|
+
*/
|
|
109
|
+
env?: HavikEnv;
|
|
110
|
+
/**
|
|
111
|
+
* API base URL, when {@link env} does not name it. Use this for a
|
|
112
|
+
* deployment the named environments do not cover: your own CDN or gateway
|
|
113
|
+
* fronting the streams API, the CN plane, or a pinned build that must
|
|
114
|
+
* outlive a domain change.
|
|
115
|
+
*
|
|
116
|
+
* Note that a base which is not a `feed[-dev].<domain>` host derives no QoE
|
|
117
|
+
* beacons endpoint, so pair it with `analytics: { endpoint }`.
|
|
118
|
+
*/
|
|
119
|
+
baseUrl?: string;
|
|
68
120
|
matchUrn: string;
|
|
69
121
|
credential: CredentialSource;
|
|
70
122
|
/**
|
|
@@ -231,6 +283,16 @@ export declare interface CreatePlayerOptions {
|
|
|
231
283
|
*/
|
|
232
284
|
analytics?: boolean | {
|
|
233
285
|
endpoint?: string;
|
|
286
|
+
/**
|
|
287
|
+
* How long the player may sit paused before the session closes itself
|
|
288
|
+
* (`END_REASON_IDLE`), and the suspension gap (OS sleep, a frozen tab)
|
|
289
|
+
* after which it does the same on waking. Default 10 minutes; `0`
|
|
290
|
+
* disables the idle close; the suspension gap never goes below five
|
|
291
|
+
* minutes, whatever this is set to (a hidden tab's throttled timers
|
|
292
|
+
* legitimately gap to a minute). After an idle close the next play()
|
|
293
|
+
* reloads the stream — a fresh session, a fresh sid, the live edge.
|
|
294
|
+
*/
|
|
295
|
+
idleMs?: number;
|
|
234
296
|
};
|
|
235
297
|
}
|
|
236
298
|
|
|
@@ -467,6 +529,16 @@ export declare type FrameToHost = {
|
|
|
467
529
|
|
|
468
530
|
export declare function getDeviceId(): string;
|
|
469
531
|
|
|
532
|
+
/**
|
|
533
|
+
* A named Oddin environment.
|
|
534
|
+
*
|
|
535
|
+
* - `integration` — the shared pre-production stack. Where customers build
|
|
536
|
+
* and test against real matches.
|
|
537
|
+
* - `production` — the production stack. A separate distribution, not an
|
|
538
|
+
* alias of integration.
|
|
539
|
+
*/
|
|
540
|
+
export declare type HavikEnv = 'integration' | 'production';
|
|
541
|
+
|
|
470
542
|
export declare interface HavikTheme {
|
|
471
543
|
/** Primary accent (play button, progress fill, live dot, focus). */
|
|
472
544
|
accent: string;
|