@codenkay/video-nsgplayer-core 5.1.0 → 5.3.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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Add `StudentLeaseClient` for online-institution student playback: `/student/playback`, a 15-second `/student/heartbeat`, and `/student/release` on stop, `ended`, and `pagehide`. `PLAYBACK_NOT_READY` is retried up to 20 times, 3 seconds apart, inside a 60-second deadline. `PLATFORM_IN_USE` (HTTP 409) is mapped to `StudentLeaseError` with `activePlatform`. `scheduleWatermark` shows `lease.watermark_text` intermittently.
8
+ - Add `AnalyticsClient`. It starts with a POST to `analytics/start` and sends event heartbeats with `watched_seconds`, `seq`, `playing`, and `ended`. The final heartbeat uses `keepalive`. Pass `send(url, body, opts)` so a BFF can wrap the call as `/api/media?url=`.
9
+ - Add `hlsConfig(isLive)` and its alias `appexHlsConfig(isLive)`, the Appextech hls.js profile (live buffer 24/40 seconds, VOD 60/120, 32MB cap, ABR tuning, live sync). Package defaults are unchanged. Set `streaming.useAppexHlsProfile: true` to apply the profile in the engine; it overrides the buffer, `startLevel`, and `lowLatencyMode` values for that player.
10
+ - Add `restoreSubtitleSelection(video, language)`. It restores only SDK-owned caption tracks (`data-sample-subtitle`, `data-appextech-subtitle`) after a media source is renewed.
11
+ - Export the `PLATFORM_IN_USE` and `PLAYBACK_NOT_READY` error codes, also available on `PlayerErrorCode`.
12
+ - Native HLS: add `streaming.nativeSessionMode` and `streaming.onNativeAuthUpdate`, and `HlsEngine.updateNativeAuthParams(params)`. With `nativeSessionMode`, a token renewal calls the callback and no longer replaces `video.src`, so playback does not reload. Without it, native renewal still reloads the source.
13
+ - Correct the proxy documentation. The browser must not call the playback host directly. The BFF must forward the validated viewer Origin on grant, refresh, and key requests.
14
+
15
+ ## 5.2.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Resume playback from `startPosition` after the media duration is known. A short opening buffer no longer pulls that seek back to the start.
20
+ - Keep a 30-second forward buffer, a 60-second ceiling, and a 20MB cap. Adaptive quality stays on the hls.js defaults.
21
+ - Refresh the playback token every 45 seconds by default (`DEFAULT_PLAYBACK_REFRESH_INTERVAL_MS`). The next request uses the new token. A proactive refresh does not restart the loader. Pass `playback.refreshIntervalMs: 0` to refresh only as the credential expires. A refresh after an authorization failure still restarts the loader.
22
+
3
23
  ## 5.1.0
4
24
 
5
25
  ### Minor Changes
package/README.md CHANGED
@@ -19,13 +19,10 @@ const player = createVideoPlayer({
19
19
  videoId: "12345",
20
20
  mount: document.querySelector("video")!,
21
21
  auth: {
22
- getToken: async (ctx) => {
23
- // Call YOUR backend — never put clientSecret here in browser code
24
- return fetch("/api/auth-token", {
25
- method: "POST",
26
- body: JSON.stringify(ctx),
27
- }).then((r) => r.json());
28
- },
22
+ getToken: async () => ({
23
+ accessToken: "bff-managed",
24
+ expiresAt: Date.now() + 60 * 60 * 1000,
25
+ }),
29
26
  },
30
27
  playback: {
31
28
  getSource: async ({ videoId }) =>
@@ -34,6 +31,12 @@ const player = createVideoPlayer({
34
31
  fetch(`/api/videos/${videoId}/proxy-refresh`, { method: "POST" }).then((r) =>
35
32
  r.json(),
36
33
  ),
34
+ // Default is 45_000. The loader keeps its buffer and uses the new token
35
+ // on the next request. Pass 0 to refresh only as the credential expires.
36
+ },
37
+ streaming: {
38
+ mediaProxyUrlBuilder: ({ url }) =>
39
+ `${location.origin}/api/media?url=${encodeURIComponent(url)}`,
37
40
  },
38
41
  });
39
42
 
@@ -41,7 +44,9 @@ player.on("ready", () => console.log("ready"));
41
44
  await player.play();
42
45
  ```
43
46
 
44
- See repository `docs/` for configuration, authentication, and security.
47
+ Core **5.2.0** keeps a 30-second forward buffer and refreshes the playback token every 45 seconds. That refresh does not restart the loader. `streaming.mediaProxyUrlBuilder` arrived in 5.1.0, which is already on npm. See repository `docs/` for configuration, authentication, and security.
48
+
49
+ Core **5.3.0** adds opt-in enterprise helpers: `StudentLeaseClient` (student lease with heartbeat, release, and `PLAYBACK_NOT_READY` retry), `AnalyticsClient` (pass `send` to route through your BFF), `appexHlsConfig(isLive)` (set `streaming.useAppexHlsProfile: true` to apply it), `restoreSubtitleSelection`, and `streaming.nativeSessionMode` for native HLS renewals that do not reload `video.src`. Package defaults are unchanged.
45
50
 
46
51
  ## Samples
47
52