@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 CHANGED
@@ -61,7 +61,7 @@ import { createPlayer } from '@oddin-gg/havik-player';
61
61
 
62
62
  const player = await createPlayer({
63
63
  video: document.querySelector('video')!,
64
- baseUrl: 'https://feed-dev.oddin-video.gg',
64
+ env: 'integration', // or 'production'
65
65
  matchUrn: 'od:match:1234',
66
66
  credential: { apiKey: 'pk_test_…' },
67
67
  autoplay: true,
@@ -81,6 +81,39 @@ player.destroy();
81
81
  The managed player handles `425 TOO_EARLY` retries (honoring `Retry-After`),
82
82
  buffering recovery, and silent DRM **license-URL refresh** for long sessions.
83
83
 
84
+ ### Choosing an environment
85
+
86
+ `env` names the stack: `integration` is the shared pre-production environment,
87
+ `production` is the production one. They are separate deployments, not
88
+ aliases. Prefer `env` over a hand-written `baseUrl`. The API host is then
89
+ correct by construction, and so is every host derived from it, including the
90
+ QoE beacons endpoint.
91
+
92
+ Pass `baseUrl` instead when the named environments do not cover your
93
+ deployment:
94
+
95
+ - your own CDN or gateway in front of the streams API
96
+ - the CN plane, whose host is not under this domain
97
+ - a pinned build that has to outlive a domain change
98
+
99
+ `baseUrl` is not deprecated and is not going away. Pass exactly one of the
100
+ two. In TypeScript, passing both or neither is a compile error. In JavaScript
101
+ it throws at `createPlayer`, because the two disagreeing is the
102
+ misconfiguration worth refusing.
103
+
104
+ Modes B and C still take a `baseUrl`. Use `baseUrlForEnv` there rather than
105
+ copying a hostname into your own config:
106
+
107
+ ```ts
108
+ import { baseUrlForEnv, resolveStream } from '@oddin-gg/havik-player';
109
+
110
+ const stream = await resolveStream({
111
+ baseUrl: baseUrlForEnv('production'),
112
+ matchUrn: 'od:match:1234',
113
+ credential: { apiKey: 'pk_live_…' },
114
+ });
115
+ ```
116
+
84
117
  ### Controls & skinning
85
118
 
86
119
  By default, Mode A renders a **branded, fully skinnable control bar**. It covers
@@ -279,8 +312,15 @@ are correlated with CDN logs via a server-minted CMCD session id (`sid`). The
279
312
  `sid` lives **only in JS memory**, never in storage or cookies, and dies with the
280
313
  player. Opt out or
281
314
  redirect with the `analytics` option on `createPlayer`
282
- (`analytics: false | { endpoint?: string }`); without a server-minted `sid` the
283
- emitter is inert.
315
+ (`analytics: false | { endpoint?: string; idleMs?: number }`); without a
316
+ server-minted `sid` the emitter is inert.
317
+
318
+ A session closes itself
319
+ (`END_REASON_IDLE`) after `idleMs` of sitting paused. The default is 10
320
+ minutes, and `0` disables it. The same close happens when the page was
321
+ suspended (OS sleep, a frozen tab) for that long. The suspension gap never
322
+ goes below five minutes, whatever `idleMs` is. The next `play()` reloads the
323
+ stream as a fresh session.
284
324
 
285
325
  ## Privacy
286
326