@phenixrts/sdk 2025.2.4-beta.630 → 2025.2.4-beta.656

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.
Files changed (51) hide show
  1. package/README.md +80 -0
  2. package/channels/debug/channels.js +1110 -1109
  3. package/channels/debug/package.json +1 -1
  4. package/channels/debug.private/channels.js +1027 -1026
  5. package/channels/debug.private/package.json +1 -1
  6. package/channels/debug.provideGlobalScope/channels.js +1082 -1081
  7. package/channels/debug.provideGlobalScope/package.json +1 -1
  8. package/channels/es5.debug.private/channels.js +4 -3
  9. package/channels/es5.debug.private/package.json +1 -1
  10. package/channels/min/channels.js +1 -1
  11. package/channels/min/channels.js.map +1 -1
  12. package/channels/min/package.json +1 -1
  13. package/channels/min.private/channels.js +1 -1
  14. package/channels/min.private/channels.js.map +1 -1
  15. package/channels/min.private/package.json +1 -1
  16. package/channels/min.provideGlobalScope/channels.js +1 -1
  17. package/channels/min.provideGlobalScope/channels.js.map +1 -1
  18. package/channels/min.provideGlobalScope/package.json +1 -1
  19. package/channels/package.json +1 -1
  20. package/full/debug/full.js +1221 -1220
  21. package/full/debug/package.json +1 -1
  22. package/full/debug.private/full.js +1138 -1137
  23. package/full/debug.private/package.json +1 -1
  24. package/full/min/full.js +1 -1
  25. package/full/min/full.js.map +1 -1
  26. package/full/min/package.json +1 -1
  27. package/full/min.private/full.js +1 -1
  28. package/full/min.private/full.js.map +1 -1
  29. package/full/min.private/package.json +1 -1
  30. package/full/package.json +1 -1
  31. package/package.json +1 -1
  32. package/publish/debug/package.json +1 -1
  33. package/publish/debug/publish.js +787 -787
  34. package/publish/debug.private/package.json +1 -1
  35. package/publish/debug.private/publish.js +787 -787
  36. package/publish/min/package.json +1 -1
  37. package/publish/min/publish.js +1 -1
  38. package/publish/min.private/package.json +1 -1
  39. package/publish/min.private/publish.js +1 -1
  40. package/publish/package.json +1 -1
  41. package/types/sdk/api/Replay.d.ts +13 -0
  42. package/types/sdk/channels/IChannelReplay.d.ts +25 -0
  43. package/types/sdk/channels/ReplayState.d.ts +17 -0
  44. package/types/sdk/context/ReplayContext.d.ts +13 -0
  45. package/types/sdk/replay/ReplayHlsLoader.d.ts +14 -0
  46. package/types/sdk/replay/ReplaySessionError.d.ts +16 -0
  47. package/types/sdk/replay/ReplayStatus.d.ts +5 -0
  48. package/types/sdk/replay/ReplayWindows.d.ts +14 -0
  49. package/types/sdk/replay/listen.d.ts +2 -0
  50. package/types/sdk/transformation/worker/MessageRouter.d.ts +1 -0
  51. package/types/sdk/transformation/worker/transforms/WorkerTransforms.d.ts +2 -0
package/README.md CHANGED
@@ -100,3 +100,83 @@ Setting different levels for the console log appender and other appenders:
100
100
  consoleLoggingLevel: 'Error'
101
101
  });
102
102
  ```
103
+
104
+ ## Providing hls.js
105
+
106
+ The SDK does not bundle hls.js, and it never fetches it for you. Chunked live playback needs it, so your application supplies the constructor through the `hlsJsLoader` option of `phenix.SDK.init`.
107
+
108
+ The SDK is built and tested against hls.js 1.7.2. Later 1.x releases have changed the APIs the SDK calls, so test playback before you move the version.
109
+
110
+ ### Preferred: bundle hls.js with your application
111
+
112
+ Install hls.js yourself, then hand the constructor to the SDK. Your lockfile pins the version, your bundler ships the code, and no third party is involved:
113
+ ```
114
+ import Hls from 'hls.js';
115
+
116
+ phenix.SDK.init({
117
+ hlsJsLoader: function(callback) {
118
+ callback(Hls);
119
+ }
120
+ });
121
+ ```
122
+
123
+ ### Loading hls.js from a CDN
124
+
125
+ If you load the SDK from a script tag and do not bundle, inject hls.js yourself. Pin the exact version and add a Subresource Integrity hash:
126
+ ```
127
+ phenix.SDK.init({
128
+ hlsJsLoader: function(callback) {
129
+ var script = document.createElement('script');
130
+
131
+ script.async = true;
132
+ script.integrity = 'sha384-xZKOEqJSfUEI1E4N6MG1+KjnKYM1R1v2WKpyaS0c+ksIxRi5PB8MAkyEdX48MX2/';
133
+ script.crossOrigin = 'anonymous';
134
+
135
+ script.onload = function() {
136
+ callback(window.Hls);
137
+ };
138
+
139
+ script.onerror = function() {
140
+ callback(undefined);
141
+ };
142
+
143
+ // Set the source last, so the handlers and the hash are in place first.
144
+ script.src = 'https://cdn.jsdelivr.net/npm/hls.js@1.7.2/dist/hls.min.js';
145
+
146
+ document.head.appendChild(script);
147
+ }
148
+ });
149
+ ```
150
+ The hash above matches hls.js 1.7.2 on jsDelivr. Regenerate it whenever you move the version:
151
+ ```
152
+ curl -fsSL https://cdn.jsdelivr.net/npm/hls.js@<version>/dist/hls.min.js |
153
+ openssl dgst -sha384 -binary | openssl base64 -A
154
+ ```
155
+
156
+ Four details matter in a loader of your own:
157
+
158
+ - **Pin the version.** A floating range such as `hls.js@1` changes the executed bytes without a release on your side, and no integrity hash can cover a moving file.
159
+ - **Keep `crossOrigin`.** Subresource Integrity needs it for a cross-origin script, and the load fails without it.
160
+ - **Inject once.** Call back immediately when `window.Hls` is already set, so repeated sessions reuse the script the page already carries.
161
+ - **Report failure.** Call back with nothing on `onerror`, as the example above does. The SDK checks for a constructor, and treats anything else as a failed load.
162
+
163
+ The SDK bounds the wait for your loader, so a loader that never calls back fails the request rather than hanging it. If your loader carries its own timeout, keep it below the SDK's bound so your own diagnostic reports first.
164
+
165
+ `examples/src/channel-viewer-hls-dash-player-loading-example.js` carries a working version of this loader.
166
+
167
+ ### Content Security Policy
168
+
169
+ Grant the origin you fetch from. For the URL above:
170
+ ```
171
+ Content-Security-Policy: script-src https://cdn.jsdelivr.net
172
+ ```
173
+ Some policies pin script hashes or set `require-sri-for`. Add the integrity hash above if yours does.
174
+
175
+ ### Before you load from a CDN
176
+
177
+ Weigh these points, because the choice is yours to make and the SDK will not make it for you:
178
+
179
+ - The fetch runs third-party code inside your origin. A compromise of the file or the CDN would run in your page, with your DOM and your tokens in reach. The pinned version and the integrity hash exist to close that gap, so keep both.
180
+ - The fetch sends every viewer's IP address, User-Agent and Referer to the CDN. Under GDPR you are the controller, so name the recipient in your privacy notice before you ship this.
181
+ - The CDN becomes an availability dependency of playback. If it is unreachable, chunked playback fails.
182
+ - A strict `script-src` policy, an offline deployment or an on-premise deployment will block the fetch. Bundle hls.js or mirror it on your own origin instead.