rx-player 4.0.0-dev.2024030400 → 4.0.0-dev.2024030500

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 (29) hide show
  1. package/VERSION +1 -1
  2. package/dist/commonjs/__GENERATED_CODE/embedded_worker.js +1 -1
  3. package/dist/commonjs/compat/browser_detection.d.ts +3 -1
  4. package/dist/commonjs/compat/browser_detection.js +8 -2
  5. package/dist/commonjs/compat/has_worker_api.d.ts +9 -0
  6. package/dist/commonjs/compat/has_worker_api.js +17 -0
  7. package/dist/commonjs/core/main/common/create_content_time_boundaries_observer.d.ts +1 -1
  8. package/dist/commonjs/core/main/common/create_content_time_boundaries_observer.js +1 -1
  9. package/dist/commonjs/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.d.ts +1 -1
  10. package/dist/commonjs/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.js +1 -1
  11. package/dist/commonjs/core/segment_sinks/segment_buffers_store.d.ts +1 -1
  12. package/dist/commonjs/core/segment_sinks/segment_buffers_store.js +1 -1
  13. package/dist/commonjs/main_thread/api/public_api.js +4 -3
  14. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  15. package/dist/es2017/compat/browser_detection.d.ts +3 -1
  16. package/dist/es2017/compat/browser_detection.js +7 -2
  17. package/dist/es2017/compat/has_worker_api.d.ts +9 -0
  18. package/dist/es2017/compat/has_worker_api.js +14 -0
  19. package/dist/es2017/core/main/common/create_content_time_boundaries_observer.d.ts +1 -1
  20. package/dist/es2017/core/main/common/create_content_time_boundaries_observer.js +1 -1
  21. package/dist/es2017/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.d.ts +1 -1
  22. package/dist/es2017/core/segment_sinks/implementations/audio_video/audio_video_segment_buffer.js +1 -1
  23. package/dist/es2017/core/segment_sinks/segment_buffers_store.d.ts +1 -1
  24. package/dist/es2017/core/segment_sinks/segment_buffers_store.js +1 -1
  25. package/dist/es2017/main_thread/api/public_api.js +4 -3
  26. package/dist/rx-player.js +25 -7
  27. package/dist/rx-player.min.js +1 -1
  28. package/dist/worker.js +1 -1
  29. package/package.json +1 -1
@@ -37,8 +37,10 @@ declare let isWebOs2021: boolean;
37
37
  declare let isWebOs2022: boolean;
38
38
  /** `true` for Panasonic devices. */
39
39
  declare let isPanasonic: boolean;
40
+ /** `true` for the PlayStation 4 game console. */
41
+ declare let isPlayStation4: boolean;
40
42
  /** `true` for the PlayStation 5 game console. */
41
43
  declare let isPlayStation5: boolean;
42
44
  /** `true` for the Xbox game consoles. */
43
45
  declare let isXbox: boolean;
44
- export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isPanasonic, isPlayStation5, isXbox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
46
+ export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isPanasonic, isPlayStation4, isPlayStation5, isXbox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
@@ -39,6 +39,8 @@ let isWebOs2021 = false;
39
39
  let isWebOs2022 = false;
40
40
  /** `true` for Panasonic devices. */
41
41
  let isPanasonic = false;
42
+ /** `true` for the PlayStation 4 game console. */
43
+ let isPlayStation4 = false;
42
44
  /** `true` for the PlayStation 5 game console. */
43
45
  let isPlayStation5 = false;
44
46
  /** `true` for the Xbox game consoles. */
@@ -92,7 +94,10 @@ let isXbox = false;
92
94
  if (/SamsungBrowser/.test(navigator.userAgent)) {
93
95
  isSamsungBrowser = true;
94
96
  }
95
- if (navigator.userAgent.indexOf("PlayStation 5") !== -1) {
97
+ if (navigator.userAgent.indexOf("PlayStation 4") !== -1) {
98
+ isPlayStation4 = true;
99
+ }
100
+ else if (navigator.userAgent.indexOf("PlayStation 5") !== -1) {
96
101
  isPlayStation5 = true;
97
102
  }
98
103
  else if (/Tizen/.test(navigator.userAgent)) {
@@ -119,4 +124,4 @@ let isXbox = false;
119
124
  isXbox = true;
120
125
  }
121
126
  })();
122
- export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isPanasonic, isPlayStation5, isXbox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
127
+ export { isEdgeChromium, isIE11, isIEOrEdge, isFirefox, isPanasonic, isPlayStation4, isPlayStation5, isXbox, isSafariDesktop, isSafariMobile, isSamsungBrowser, isTizen, isWebOs, isWebOs2021, isWebOs2022, };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Return `true` if the current device is compatible with the Worker API.
3
+ *
4
+ * Some old webkit devices, such as the PlayStation 4, returns weird results
5
+ * when doing the most straightforward check. We have to check if other Webkit
6
+ * devices have the same issue.
7
+ * @returns {boolean}
8
+ */
9
+ export default function hasWorkerApi(): boolean;
@@ -0,0 +1,14 @@
1
+ import { isPlayStation4 } from "./browser_detection";
2
+ /**
3
+ * Return `true` if the current device is compatible with the Worker API.
4
+ *
5
+ * Some old webkit devices, such as the PlayStation 4, returns weird results
6
+ * when doing the most straightforward check. We have to check if other Webkit
7
+ * devices have the same issue.
8
+ * @returns {boolean}
9
+ */
10
+ export default function hasWorkerApi() {
11
+ return isPlayStation4 ?
12
+ typeof Worker === "object" || typeof Worker === "function" :
13
+ typeof Worker === "function";
14
+ }
@@ -18,7 +18,7 @@ export interface IContentTimeBoundariesObserverCallbacks {
18
18
  * Various methods from that class need then to be called at various events
19
19
  * (see `ContentTimeBoundariesObserver`).
20
20
  * @param {Object} manifest
21
- * @param {MediaSource} mediaSource
21
+ * @param {Object} mediaSource
22
22
  * @param {Object} streamObserver
23
23
  * @param {Object} segmentSinksStore
24
24
  * @param {Object} cancelSignal
@@ -9,7 +9,7 @@ import ContentTimeBoundariesObserver from "./content_time_boundaries_observer";
9
9
  * Various methods from that class need then to be called at various events
10
10
  * (see `ContentTimeBoundariesObserver`).
11
11
  * @param {Object} manifest
12
- * @param {MediaSource} mediaSource
12
+ * @param {Object} mediaSource
13
13
  * @param {Object} streamObserver
14
14
  * @param {Object} segmentSinksStore
15
15
  * @param {Object} cancelSignal
@@ -60,7 +60,7 @@ export default class AudioVideoSegmentSink extends SegmentSink {
60
60
  * @constructor
61
61
  * @param {string} bufferType
62
62
  * @param {string} codec
63
- * @param {MediaSource} mediaSource
63
+ * @param {Object} mediaSource
64
64
  */
65
65
  constructor(bufferType: SourceBufferType, codec: string, mediaSource: IMediaSourceInterface);
66
66
  /** @see SegmentSink */
@@ -31,7 +31,7 @@ export default class AudioVideoSegmentSink extends SegmentSink {
31
31
  * @constructor
32
32
  * @param {string} bufferType
33
33
  * @param {string} codec
34
- * @param {MediaSource} mediaSource
34
+ * @param {Object} mediaSource
35
35
  */
36
36
  constructor(bufferType, codec, mediaSource) {
37
37
  super();
@@ -69,7 +69,7 @@ export default class SegmentSinksStore {
69
69
  private _textInterface;
70
70
  private _hasVideo;
71
71
  /**
72
- * @param {MediaSource} mediaSource
72
+ * @param {Object} mediaSource
73
73
  * @constructor
74
74
  */
75
75
  constructor(mediaSource: IMediaSourceInterface, hasVideo: boolean, textDisplayerInterface: ITextDisplayerInterface | null);
@@ -55,7 +55,7 @@ export default class SegmentSinksStore {
55
55
  return shouldHaveNativeBuffer(bufferType);
56
56
  }
57
57
  /**
58
- * @param {MediaSource} mediaSource
58
+ * @param {Object} mediaSource
59
59
  * @constructor
60
60
  */
61
61
  constructor(mediaSource, hasVideo, textDisplayerInterface) {
@@ -21,6 +21,7 @@ import canRelyOnVideoVisibilityAndSize from "../../compat/can_rely_on_video_visi
21
21
  import { getPictureOnPictureStateRef, getVideoVisibilityRef, getElementResolutionRef, getScreenResolutionRef, } from "../../compat/event_listeners";
22
22
  import getStartDate from "../../compat/get_start_date";
23
23
  import hasMseInWorker from "../../compat/has_mse_in_worker";
24
+ import hasWorkerApi from "../../compat/has_worker_api";
24
25
  import isDebugModeEnabled from "../../compat/is_debug_mode_enabled";
25
26
  import { ErrorCodes, ErrorTypes, formatError, MediaError } from "../../errors";
26
27
  import WorkerInitializationError from "../../errors/worker_initialization_error";
@@ -102,7 +103,7 @@ class Player extends EventEmitter {
102
103
  // Workaround to support Firefox autoplay on FF 42.
103
104
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
104
105
  videoElement.preload = "auto";
105
- this.version = /* PLAYER_VERSION */ "4.0.0-dev.2024030400";
106
+ this.version = /* PLAYER_VERSION */ "4.0.0-dev.2024030500";
106
107
  this.log = log;
107
108
  this.state = "STOPPED";
108
109
  this.videoElement = videoElement;
@@ -147,7 +148,7 @@ class Player extends EventEmitter {
147
148
  attachWorker(workerSettings) {
148
149
  return new Promise((res, rej) => {
149
150
  var _a;
150
- if (typeof Worker !== "function") {
151
+ if (!hasWorkerApi()) {
151
152
  log.warn("API: Cannot rely on a WebWorker: Worker API unavailable");
152
153
  return rej(new WorkerInitializationError("INCOMPATIBLE_ERROR", "Worker unavailable"));
153
154
  }
@@ -2343,5 +2344,5 @@ class Player extends EventEmitter {
2343
2344
  }
2344
2345
  }
2345
2346
  }
2346
- Player.version = /* PLAYER_VERSION */ "4.0.0-dev.2024030400";
2347
+ Player.version = /* PLAYER_VERSION */ "4.0.0-dev.2024030500";
2347
2348
  export default Player;
package/dist/rx-player.js CHANGED
@@ -11797,7 +11797,7 @@ function getEndingPositionFromAdaptation(adaptation) {
11797
11797
  * Various methods from that class need then to be called at various events
11798
11798
  * (see `ContentTimeBoundariesObserver`).
11799
11799
  * @param {Object} manifest
11800
- * @param {MediaSource} mediaSource
11800
+ * @param {Object} mediaSource
11801
11801
  * @param {Object} streamObserver
11802
11802
  * @param {Object} segmentSinksStore
11803
11803
  * @param {Object} cancelSignal
@@ -13038,7 +13038,7 @@ var AudioVideoSegmentSink = /*#__PURE__*/function (_SegmentSink) {
13038
13038
  * @constructor
13039
13039
  * @param {string} bufferType
13040
13040
  * @param {string} codec
13041
- * @param {MediaSource} mediaSource
13041
+ * @param {Object} mediaSource
13042
13042
  */
13043
13043
  function AudioVideoSegmentSink(bufferType, codec, mediaSource) {
13044
13044
  var _this;
@@ -13648,7 +13648,7 @@ var SegmentSinksStore = /*#__PURE__*/function () {
13648
13648
  return shouldHaveNativeBuffer(bufferType);
13649
13649
  }
13650
13650
  /**
13651
- * @param {MediaSource} mediaSource
13651
+ * @param {Object} mediaSource
13652
13652
  * @constructor
13653
13653
  */;
13654
13654
  function SegmentSinksStore(mediaSource, hasVideo, textDisplayerInterface) {
@@ -19603,6 +19603,8 @@ var isWebOs2021 = false;
19603
19603
  var isWebOs2022 = false;
19604
19604
  /** `true` for Panasonic devices. */
19605
19605
  var isPanasonic = false;
19606
+ /** `true` for the PlayStation 4 game console. */
19607
+ var isPlayStation4 = false;
19606
19608
  /** `true` for the PlayStation 5 game console. */
19607
19609
  var isPlayStation5 = false;
19608
19610
  /** `true` for the Xbox game consoles. */
@@ -19643,7 +19645,9 @@ var isXbox = false;
19643
19645
  if (/SamsungBrowser/.test(navigator.userAgent)) {
19644
19646
  isSamsungBrowser = true;
19645
19647
  }
19646
- if (navigator.userAgent.indexOf("PlayStation 5") !== -1) {
19648
+ if (navigator.userAgent.indexOf("PlayStation 4") !== -1) {
19649
+ isPlayStation4 = true;
19650
+ } else if (navigator.userAgent.indexOf("PlayStation 5") !== -1) {
19647
19651
  isPlayStation5 = true;
19648
19652
  } else if (/Tizen/.test(navigator.userAgent)) {
19649
19653
  isTizen = true;
@@ -50174,6 +50178,19 @@ function getStartDate(mediaElement) {
50174
50178
  var hasMseInWorker = typeof MediaSource === "function" && /* eslint-disable-next-line */
50175
50179
  MediaSource.canConstructInDedicatedWorker === true;
50176
50180
  /* harmony default export */ var has_mse_in_worker = (hasMseInWorker);
50181
+ ;// CONCATENATED MODULE: ./src/compat/has_worker_api.ts
50182
+
50183
+ /**
50184
+ * Return `true` if the current device is compatible with the Worker API.
50185
+ *
50186
+ * Some old webkit devices, such as the PlayStation 4, returns weird results
50187
+ * when doing the most straightforward check. We have to check if other Webkit
50188
+ * devices have the same issue.
50189
+ * @returns {boolean}
50190
+ */
50191
+ function hasWorkerApi() {
50192
+ return isPlayStation4 ? typeof Worker === "object" || typeof Worker === "function" : typeof Worker === "function";
50193
+ }
50177
50194
  ;// CONCATENATED MODULE: ./src/errors/worker_initialization_error.ts
50178
50195
 
50179
50196
 
@@ -52931,6 +52948,7 @@ function public_api_arrayLikeToArray(arr, len) { if (len == null || len > arr.le
52931
52948
 
52932
52949
 
52933
52950
 
52951
+
52934
52952
 
52935
52953
 
52936
52954
  /* eslint-disable @typescript-eslint/naming-convention */
@@ -52977,7 +52995,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
52977
52995
  // Workaround to support Firefox autoplay on FF 42.
52978
52996
  // See: https://bugzilla.mozilla.org/show_bug.cgi?id=1194624
52979
52997
  videoElement.preload = "auto";
52980
- _this.version = /* PLAYER_VERSION */"4.0.0-dev.2024030400";
52998
+ _this.version = /* PLAYER_VERSION */"4.0.0-dev.2024030500";
52981
52999
  _this.log = src_log;
52982
53000
  _this.state = "STOPPED";
52983
53001
  _this.videoElement = videoElement;
@@ -53028,7 +53046,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
53028
53046
  var _this2 = this;
53029
53047
  return new Promise(function (res, rej) {
53030
53048
  var _a;
53031
- if (typeof Worker !== "function") {
53049
+ if (!hasWorkerApi()) {
53032
53050
  src_log.warn("API: Cannot rely on a WebWorker: Worker API unavailable");
53033
53051
  return rej(new WorkerInitializationError("INCOMPATIBLE_ERROR", "Worker unavailable"));
53034
53052
  }
@@ -55401,7 +55419,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
55401
55419
  }]);
55402
55420
  return Player;
55403
55421
  }(EventEmitter);
55404
- Player.version = /* PLAYER_VERSION */"4.0.0-dev.2024030400";
55422
+ Player.version = /* PLAYER_VERSION */"4.0.0-dev.2024030500";
55405
55423
  /* harmony default export */ var public_api = (Player);
55406
55424
  ;// CONCATENATED MODULE: ./src/main_thread/api/index.ts
55407
55425
  /**