rx-player 4.2.0-dev.2024090500 → 4.2.0-dev.2024090600

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 (38) hide show
  1. package/CHANGELOG.md +5 -2
  2. package/VERSION +1 -1
  3. package/dist/commonjs/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  4. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  5. package/dist/commonjs/compat/browser_detection.d.ts +3 -1
  6. package/dist/commonjs/compat/browser_detection.d.ts.map +1 -1
  7. package/dist/commonjs/compat/browser_detection.js +7 -1
  8. package/dist/commonjs/compat/can_reuse_media_keys.d.ts +4 -0
  9. package/dist/commonjs/compat/can_reuse_media_keys.d.ts.map +1 -1
  10. package/dist/commonjs/compat/can_reuse_media_keys.js +5 -1
  11. package/dist/commonjs/core/main/worker/worker_main.js +4 -0
  12. package/dist/commonjs/main_thread/api/public_api.js +2 -2
  13. package/dist/commonjs/utils/logger.d.ts.map +1 -1
  14. package/dist/commonjs/utils/logger.js +6 -7
  15. package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  16. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  17. package/dist/es2017/compat/browser_detection.d.ts +3 -1
  18. package/dist/es2017/compat/browser_detection.d.ts.map +1 -1
  19. package/dist/es2017/compat/browser_detection.js +10 -1
  20. package/dist/es2017/compat/can_reuse_media_keys.d.ts +4 -0
  21. package/dist/es2017/compat/can_reuse_media_keys.d.ts.map +1 -1
  22. package/dist/es2017/compat/can_reuse_media_keys.js +6 -2
  23. package/dist/es2017/core/main/worker/worker_main.js +4 -0
  24. package/dist/es2017/main_thread/api/public_api.js +2 -2
  25. package/dist/es2017/utils/logger.d.ts.map +1 -1
  26. package/dist/es2017/utils/logger.js +6 -7
  27. package/dist/rx-player.js +12 -10
  28. package/dist/rx-player.min.js +18 -18
  29. package/dist/worker.js +5 -5
  30. package/package.json +5 -12
  31. package/src/README.md +7 -7
  32. package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
  33. package/src/compat/__tests__/can_reuse_media_keys.test.ts +24 -1
  34. package/src/compat/browser_detection.ts +13 -4
  35. package/src/compat/can_reuse_media_keys.ts +6 -2
  36. package/src/core/main/worker/worker_main.ts +4 -0
  37. package/src/main_thread/api/public_api.ts +2 -2
  38. package/src/utils/logger.ts +6 -7
@@ -8,7 +8,12 @@ describe("Compat - canReuseMediaKeys", () => {
8
8
 
9
9
  it("should return true on most browsers", async () => {
10
10
  vi.doMock("../browser_detection", () => {
11
- return { isWebOs: false, isPhilipsNetTv: false, isPanasonic: false };
11
+ return {
12
+ isA1KStb40xx: false,
13
+ isWebOs: false,
14
+ isPhilipsNetTv: false,
15
+ isPanasonic: false,
16
+ };
12
17
  });
13
18
  const canReuseMediaKeys = (await vi.importActual("../can_reuse_media_keys.ts"))
14
19
  .default as typeof ICanReuseMediaKeys;
@@ -18,6 +23,7 @@ describe("Compat - canReuseMediaKeys", () => {
18
23
  it("should return false on WebOs", async () => {
19
24
  vi.doMock("../browser_detection", () => {
20
25
  return {
26
+ isA1KStb40xx: false,
21
27
  isWebOs: true,
22
28
  isWebOs2022: false,
23
29
  isPanasonic: false,
@@ -32,6 +38,7 @@ describe("Compat - canReuseMediaKeys", () => {
32
38
  it("should return false on Panasonic", async () => {
33
39
  vi.doMock("../browser_detection", () => {
34
40
  return {
41
+ isA1KStb40xx: false,
35
42
  isWebOs: false,
36
43
  isWebOs2022: false,
37
44
  isPanasonic: true,
@@ -46,6 +53,7 @@ describe("Compat - canReuseMediaKeys", () => {
46
53
  it("should return false on Philips' NETTV", async () => {
47
54
  vi.doMock("../browser_detection", () => {
48
55
  return {
56
+ isA1KStb40xx: false,
49
57
  isWebOs: false,
50
58
  isWebOs2022: false,
51
59
  isPanasonic: false,
@@ -56,4 +64,19 @@ describe("Compat - canReuseMediaKeys", () => {
56
64
  .default as typeof ICanReuseMediaKeys;
57
65
  expect(canReuseMediaKeys()).toBe(false);
58
66
  });
67
+
68
+ it("should return false on A1 KSTB 40xxx", async () => {
69
+ vi.doMock("../browser_detection", () => {
70
+ return {
71
+ isA1KStb40xx: true,
72
+ isWebOs: false,
73
+ isWebOs2022: false,
74
+ isPanasonic: false,
75
+ isPhilipsNetTv: false,
76
+ };
77
+ });
78
+ const canReuseMediaKeys = (await vi.importActual("../can_reuse_media_keys.ts"))
79
+ .default as typeof ICanReuseMediaKeys;
80
+ expect(canReuseMediaKeys()).toBe(false);
81
+ });
59
82
  });
@@ -79,6 +79,9 @@ let isPlayStation5 = false;
79
79
  /** `true` for the Xbox game consoles. */
80
80
  let isXbox = false;
81
81
 
82
+ /** `true` for specific A1 STB: KSTB 40xx from Kaon Media. */
83
+ let isA1KStb40xx = false;
84
+
82
85
  (function findCurrentBrowser(): void {
83
86
  if (isNode) {
84
87
  return;
@@ -167,24 +170,30 @@ let isXbox = false;
167
170
  isPanasonic = true;
168
171
  } else if (navigator.userAgent.indexOf("Xbox") !== -1) {
169
172
  isXbox = true;
173
+ } else if (navigator.userAgent.indexOf("Model/a1-kstb40xx")) {
174
+ isA1KStb40xx = true;
170
175
  }
171
176
  })();
172
177
 
173
178
  export {
179
+ // browsers
174
180
  isEdgeChromium,
181
+ isFirefox,
175
182
  isIE11,
176
183
  isIEOrEdge,
177
- isFirefox,
184
+ isSafariDesktop,
185
+ isSafariMobile,
186
+
187
+ // specific devices
188
+ isA1KStb40xx,
178
189
  isPanasonic,
179
190
  isPhilipsNetTv,
180
191
  isPlayStation4,
181
192
  isPlayStation5,
182
- isXbox,
183
- isSafariDesktop,
184
- isSafariMobile,
185
193
  isSamsungBrowser,
186
194
  isTizen,
187
195
  isWebOs,
188
196
  isWebOs2021,
189
197
  isWebOs2022,
198
+ isXbox,
190
199
  };
@@ -1,4 +1,4 @@
1
- import { isPanasonic, isPhilipsNetTv, isWebOs } from "./browser_detection";
1
+ import { isA1KStb40xx, isPanasonic, isPhilipsNetTv, isWebOs } from "./browser_detection";
2
2
 
3
3
  /**
4
4
  * Returns `true` if a `MediaKeys` instance (the `Encrypted Media Extension`
@@ -11,9 +11,13 @@ import { isPanasonic, isPhilipsNetTv, isWebOs } from "./browser_detection";
11
11
  * HTMLMediaElement.
12
12
  * - (2024-08-23): Seen on Philips 2024 and 2023 in:
13
13
  * https://github.com/canalplus/rx-player/issues/1464
14
+ * - (2024-09-04): Another case seen on an "A1" set-top box model made by
15
+ * Kaonmedia we will call the KSTB40xx.
16
+ * It may share the problematic with other devices, but we have only seen
17
+ * the problem on this one for now.
14
18
  *
15
19
  * @returns {boolean}
16
20
  */
17
21
  export default function canReuseMediaKeys(): boolean {
18
- return !isWebOs && !isPhilipsNetTv && !isPanasonic;
22
+ return !isWebOs && !isPhilipsNetTv && !isPanasonic && !isA1KStb40xx;
19
23
  }
@@ -884,6 +884,10 @@ function loadOrReloadPreparedContent(
884
884
  );
885
885
  },
886
886
  (err: unknown) => {
887
+ if (TaskCanceller.isCancellationError(err)) {
888
+ log.info("WP: A reloading operation was cancelled");
889
+ return;
890
+ }
887
891
  sendMessage({
888
892
  type: WorkerMessageType.Error,
889
893
  contentId,
@@ -409,7 +409,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
409
409
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
410
410
  videoElement.preload = "auto";
411
411
 
412
- this.version = /* PLAYER_VERSION */ "4.2.0-dev.2024090500";
412
+ this.version = /* PLAYER_VERSION */ "4.2.0-dev.2024090600";
413
413
  this.log = log;
414
414
  this.state = "STOPPED";
415
415
  this.videoElement = videoElement;
@@ -3313,7 +3313,7 @@ class Player extends EventEmitter<IPublicAPIEvent> {
3313
3313
  }
3314
3314
  }
3315
3315
  }
3316
- Player.version = /* PLAYER_VERSION */ "4.2.0-dev.2024090500";
3316
+ Player.version = /* PLAYER_VERSION */ "4.2.0-dev.2024090600";
3317
3317
 
3318
3318
  /** Every events sent by the RxPlayer's public API. */
3319
3319
  interface IPublicAPIEvent {
@@ -138,18 +138,17 @@ export default class Logger extends EventEmitter<ILoggerEvents> {
138
138
  /* eslint-enable no-console */
139
139
  /* eslint-enable no-invalid-this */
140
140
  } else {
141
- const produceLogFn = (logLevel: ILoggerLevel, namespace: string) => {
141
+ const produceLogFn = (logLevel: ILoggerLevel) => {
142
142
  return level >= this._levels[logLevel]
143
143
  ? (...args: IAcceptedLogValue[]) => {
144
- const now = getMonotonicTimeStamp();
145
- return logFn(logLevel, [now, namespace, ...args]);
144
+ return logFn(logLevel, args);
146
145
  }
147
146
  : noop;
148
147
  };
149
- this.error = produceLogFn("ERROR", "error");
150
- this.warn = produceLogFn("WARNING", "warn");
151
- this.info = produceLogFn("INFO", "info");
152
- this.debug = produceLogFn("DEBUG", "log");
148
+ this.error = produceLogFn("ERROR");
149
+ this.warn = produceLogFn("WARNING");
150
+ this.info = produceLogFn("INFO");
151
+ this.debug = produceLogFn("DEBUG");
153
152
  }
154
153
 
155
154
  this.trigger("onLogLevelChange", {