rx-player 3.27.1-dev.2022041500 → 3.27.1-dev.2022051100

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 (27) hide show
  1. package/CHANGELOG.md +11 -5
  2. package/VERSION +1 -1
  3. package/dist/_esm5.processed/core/api/public_api.js +2 -2
  4. package/dist/_esm5.processed/core/decrypt/content_decryptor.js +12 -10
  5. package/dist/_esm5.processed/core/decrypt/utils/key_session_record.js +2 -1
  6. package/dist/_esm5.processed/core/init/throw_on_media_error.js +19 -10
  7. package/dist/_esm5.processed/manifest/representation.js +4 -4
  8. package/dist/_esm5.processed/parsers/manifest/dash/common/flatten_overlapping_periods.js +11 -1
  9. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.d.ts +2 -0
  10. package/dist/_esm5.processed/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.js +9 -2
  11. package/dist/_esm5.processed/parsers/manifest/dash/common/parse_representations.js +10 -3
  12. package/dist/_esm5.processed/parsers/manifest/types.d.ts +7 -2
  13. package/dist/_esm5.processed/parsers/texttracks/ttml/html/generate_css_test_outline.js +14 -4
  14. package/dist/rx-player.js +85 -33
  15. package/dist/rx-player.min.js +1 -1
  16. package/package.json +1 -1
  17. package/sonar-project.properties +1 -1
  18. package/src/core/api/public_api.ts +2 -2
  19. package/src/core/decrypt/content_decryptor.ts +12 -10
  20. package/src/core/decrypt/utils/key_session_record.ts +2 -1
  21. package/src/core/init/throw_on_media_error.ts +25 -15
  22. package/src/manifest/representation.ts +2 -2
  23. package/src/parsers/manifest/dash/common/flatten_overlapping_periods.ts +10 -1
  24. package/src/parsers/manifest/dash/common/indexes/timeline/timeline_representation_index.ts +12 -2
  25. package/src/parsers/manifest/dash/common/parse_representations.ts +9 -3
  26. package/src/parsers/manifest/types.ts +7 -2
  27. package/src/parsers/texttracks/ttml/html/generate_css_test_outline.ts +15 -4
package/dist/rx-player.js CHANGED
@@ -6348,7 +6348,7 @@ var KeySessionRecord = /*#__PURE__*/function () {
6348
6348
  _proto.isCompatibleWith = function isCompatibleWith(initializationData) {
6349
6349
  var keyIds = initializationData.keyIds;
6350
6350
 
6351
- if (keyIds !== undefined) {
6351
+ if (keyIds !== undefined && keyIds.length > 0) {
6352
6352
  if (this._keyIds !== null && areAllKeyIdsContainedIn(keyIds, this._keyIds)) {
6353
6353
  return true;
6354
6354
  }
@@ -6362,7 +6362,7 @@ var KeySessionRecord = /*#__PURE__*/function () {
6362
6362
  };
6363
6363
 
6364
6364
  _proto._checkInitializationDataCompatibility = function _checkInitializationDataCompatibility(initializationData) {
6365
- if (initializationData.keyIds !== undefined && this._initializationData.keyIds !== undefined) {
6365
+ if (initializationData.keyIds !== undefined && initializationData.keyIds.length > 0 && this._initializationData.keyIds !== undefined) {
6366
6366
  return areAllKeyIdsContainedIn(initializationData.keyIds, this._initializationData.keyIds);
6367
6367
  }
6368
6368
 
@@ -9855,18 +9855,20 @@ function updateDecipherability(manifest, whitelistedKeyIds, blacklistedKeyIDs) {
9855
9855
 
9856
9856
  var contentKIDs = representation.contentProtections.keyIds;
9857
9857
 
9858
- for (var i = 0; i < contentKIDs.length; i++) {
9859
- var elt = contentKIDs[i];
9858
+ if (contentKIDs !== undefined) {
9859
+ for (var i = 0; i < contentKIDs.length; i++) {
9860
+ var elt = contentKIDs[i];
9860
9861
 
9861
- for (var j = 0; j < blacklistedKeyIDs.length; j++) {
9862
- if (areKeyIdsEqual(blacklistedKeyIDs[j], elt.keyId)) {
9863
- return false;
9862
+ for (var j = 0; j < blacklistedKeyIDs.length; j++) {
9863
+ if (areKeyIdsEqual(blacklistedKeyIDs[j], elt.keyId)) {
9864
+ return false;
9865
+ }
9864
9866
  }
9865
- }
9866
9867
 
9867
- for (var _j = 0; _j < whitelistedKeyIds.length; _j++) {
9868
- if (areKeyIdsEqual(whitelistedKeyIds[_j], elt.keyId)) {
9869
- return true;
9868
+ for (var _j = 0; _j < whitelistedKeyIds.length; _j++) {
9869
+ if (areKeyIdsEqual(whitelistedKeyIds[_j], elt.keyId)) {
9870
+ return true;
9871
+ }
9870
9872
  }
9871
9873
  }
9872
9874
  }
@@ -10094,7 +10096,7 @@ function addKeyIdsFromPeriod(set, period) {
10094
10096
  for (var _iterator6 = content_decryptor_createForOfIteratorHelperLoose(adaptation.representations), _step6; !(_step6 = _iterator6()).done;) {
10095
10097
  var representation = _step6.value;
10096
10098
 
10097
- if (representation.contentProtections !== undefined && representation.contentProtections.keyIds.length >= -1) {
10099
+ if (representation.contentProtections !== undefined && representation.contentProtections.keyIds !== undefined) {
10098
10100
  for (var _iterator7 = content_decryptor_createForOfIteratorHelperLoose(representation.contentProtections.keyIds), _step7; !(_step7 = _iterator7()).done;) {
10099
10101
  var kidInf = _step7.value;
10100
10102
  set.add(kidInf.keyId);
@@ -11619,7 +11621,8 @@ function generateDiscontinuityError(stalledPosition, seekTo) {
11619
11621
  /* harmony export */ });
11620
11622
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2401);
11621
11623
  /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7877);
11622
- /* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(3714);
11624
+ /* harmony import */ var _errors__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3714);
11625
+ /* harmony import */ var _utils_is_null_or_undefined__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1946);
11623
11626
  /**
11624
11627
  * Copyright 2015 CANAL+ Group
11625
11628
  *
@@ -11637,6 +11640,7 @@ function generateDiscontinuityError(stalledPosition, seekTo) {
11637
11640
  */
11638
11641
 
11639
11642
 
11643
+
11640
11644
  /**
11641
11645
  * Returns an observable which throws the right MediaError as soon an "error"
11642
11646
  * event is received through the media element.
@@ -11646,23 +11650,35 @@ function generateDiscontinuityError(stalledPosition, seekTo) {
11646
11650
 
11647
11651
  function throwOnMediaError(mediaElement) {
11648
11652
  return (0,rxjs__WEBPACK_IMPORTED_MODULE_0__/* .fromEvent */ .R)(mediaElement, "error").pipe((0,rxjs__WEBPACK_IMPORTED_MODULE_1__/* .mergeMap */ .z)(function () {
11649
- var errorCode = mediaElement.error == null ? 0 : mediaElement.error.code;
11653
+ var mediaError = mediaElement.error;
11654
+ var errorCode;
11655
+ var errorMessage;
11656
+
11657
+ if (!(0,_utils_is_null_or_undefined__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(mediaError)) {
11658
+ errorCode = mediaError.code;
11659
+ errorMessage = mediaError.message;
11660
+ }
11650
11661
 
11651
11662
  switch (errorCode) {
11652
11663
  case 1:
11653
- throw new _errors__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z("MEDIA_ERR_ABORTED", "The fetching of the associated resource was aborted " + "by the user's request.");
11664
+ errorMessage = errorMessage !== null && errorMessage !== void 0 ? errorMessage : "The fetching of the associated resource was aborted by the user's request.";
11665
+ throw new _errors__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z("MEDIA_ERR_ABORTED", errorMessage);
11654
11666
 
11655
11667
  case 2:
11656
- throw new _errors__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z("MEDIA_ERR_NETWORK", "A network error occurred which prevented the media " + "from being successfully fetched");
11668
+ errorMessage = errorMessage !== null && errorMessage !== void 0 ? errorMessage : "A network error occurred which prevented the media from being " + "successfully fetched";
11669
+ throw new _errors__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z("MEDIA_ERR_NETWORK", errorMessage);
11657
11670
 
11658
11671
  case 3:
11659
- throw new _errors__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z("MEDIA_ERR_DECODE", "An error occurred while trying to decode the media " + "resource");
11672
+ errorMessage = errorMessage !== null && errorMessage !== void 0 ? errorMessage : "An error occurred while trying to decode the media resource";
11673
+ throw new _errors__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z("MEDIA_ERR_DECODE", errorMessage);
11660
11674
 
11661
11675
  case 4:
11662
- throw new _errors__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z("MEDIA_ERR_SRC_NOT_SUPPORTED", "The media resource has been found to be unsuitable.");
11676
+ errorMessage = errorMessage !== null && errorMessage !== void 0 ? errorMessage : "The media resource has been found to be unsuitable.";
11677
+ throw new _errors__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z("MEDIA_ERR_SRC_NOT_SUPPORTED", errorMessage);
11663
11678
 
11664
11679
  default:
11665
- throw new _errors__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z("MEDIA_ERR_UNKNOWN", "The HTMLMediaElement errored due to an unknown reason.");
11680
+ errorMessage = errorMessage !== null && errorMessage !== void 0 ? errorMessage : "The HTMLMediaElement errored due to an unknown reason.";
11681
+ throw new _errors__WEBPACK_IMPORTED_MODULE_3__/* ["default"] */ .Z("MEDIA_ERR_UNKNOWN", errorMessage);
11666
11682
  }
11667
11683
  }));
11668
11684
  }
@@ -16231,7 +16247,7 @@ var Representation = /*#__PURE__*/function () {
16231
16247
  ;
16232
16248
 
16233
16249
  _proto.getEncryptionData = function getEncryptionData(drmSystemId) {
16234
- var _a;
16250
+ var _a, _b;
16235
16251
 
16236
16252
  var allInitData = this.getAllEncryptionData();
16237
16253
  var filtered = [];
@@ -16243,7 +16259,7 @@ var Representation = /*#__PURE__*/function () {
16243
16259
  for (var j = 0; j < initData.values.length; j++) {
16244
16260
  if (initData.values[j].systemId.toLowerCase() === drmSystemId.toLowerCase()) {
16245
16261
  if (!createdObjForType) {
16246
- var keyIds = (_a = this.contentProtections) === null || _a === void 0 ? void 0 : _a.keyIds.map(function (val) {
16262
+ var keyIds = (_b = (_a = this.contentProtections) === null || _a === void 0 ? void 0 : _a.keyIds) === null || _b === void 0 ? void 0 : _b.map(function (val) {
16247
16263
  return val.keyId;
16248
16264
  });
16249
16265
  filtered.push({
@@ -16290,13 +16306,13 @@ var Representation = /*#__PURE__*/function () {
16290
16306
  ;
16291
16307
 
16292
16308
  _proto.getAllEncryptionData = function getAllEncryptionData() {
16293
- var _a;
16309
+ var _a, _b;
16294
16310
 
16295
16311
  if (this.contentProtections === undefined || this.contentProtections.initData.length === 0) {
16296
16312
  return [];
16297
16313
  }
16298
16314
 
16299
- var keyIds = (_a = this.contentProtections) === null || _a === void 0 ? void 0 : _a.keyIds.map(function (val) {
16315
+ var keyIds = (_b = (_a = this.contentProtections) === null || _a === void 0 ? void 0 : _a.keyIds) === null || _b === void 0 ? void 0 : _b.map(function (val) {
16300
16316
  return val.keyId;
16301
16317
  });
16302
16318
  return this.contentProtections.initData.map(function (x) {
@@ -20159,7 +20175,16 @@ function flattenOverlappingPeriods(parsedPeriods) {
20159
20175
  lastFlattenedPeriod.duration = parsedPeriod.start - lastFlattenedPeriod.start;
20160
20176
  lastFlattenedPeriod.end = parsedPeriod.start;
20161
20177
 
20162
- if (lastFlattenedPeriod.duration <= 0) {
20178
+ if (lastFlattenedPeriod.duration > 0) {
20179
+ // Note: Calling `break` to quit the while loop should theoritically be
20180
+ // unnecessary as the previous operations should ensure we do not re-enter
20181
+ // the loop's condition.
20182
+ // Yet we dit encounter infinite loops without it because of float-related
20183
+ // rounding errors.
20184
+ break;
20185
+ } else {
20186
+ // `lastFlattenedPeriod` has now a negative or `0` duration.
20187
+ // Remove it, consider the next Period in its place, and re-start the loop.
20163
20188
  flattenedPeriods.pop();
20164
20189
  lastFlattenedPeriod = flattenedPeriods[flattenedPeriods.length - 1];
20165
20190
  }
@@ -21453,6 +21478,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
21453
21478
  timeline: (_c = index.timeline) !== null && _c !== void 0 ? _c : null,
21454
21479
  timescale: timescale
21455
21480
  };
21481
+ this._periodStart = periodStart;
21456
21482
  this._scaledPeriodStart = (0,index_helpers/* toIndexTime */.gT)(periodStart, this._index);
21457
21483
  this._scaledPeriodEnd = periodEnd === undefined ? undefined : (0,index_helpers/* toIndexTime */.gT)(periodEnd, this._index);
21458
21484
  }
@@ -21629,6 +21655,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
21629
21655
  this._index = newIndex._index;
21630
21656
  this._isDynamic = newIndex._isDynamic;
21631
21657
  this._scaledPeriodStart = newIndex._scaledPeriodStart;
21658
+ this._periodStart = newIndex._periodStart;
21632
21659
  this._scaledPeriodEnd = newIndex._scaledPeriodEnd;
21633
21660
  this._lastUpdate = newIndex._lastUpdate;
21634
21661
  this._manifestBoundsCalculator = newIndex._manifestBoundsCalculator;
@@ -21658,6 +21685,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
21658
21685
 
21659
21686
  this._isDynamic = newIndex._isDynamic;
21660
21687
  this._scaledPeriodStart = newIndex._scaledPeriodStart;
21688
+ this._periodStart = newIndex._periodStart;
21661
21689
  this._scaledPeriodEnd = newIndex._scaledPeriodEnd;
21662
21690
  this._lastUpdate = newIndex._lastUpdate;
21663
21691
  this._isLastPeriod = newIndex._isLastPeriod;
@@ -21725,6 +21753,10 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
21725
21753
  this._index.timeline = this._getTimeline();
21726
21754
  }
21727
21755
 
21756
+ if (!this._isDynamic) {
21757
+ return;
21758
+ }
21759
+
21728
21760
  var firstPosition = this._manifestBoundsCalculator.estimateMinimumBound();
21729
21761
 
21730
21762
  if (firstPosition == null) {
@@ -21784,12 +21816,14 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
21784
21816
 
21785
21817
  this._parseTimeline = null; // Free memory
21786
21818
 
21819
+ var actualPeriodStart = this._periodStart * this._index.timescale;
21820
+
21787
21821
  var _config$getCurrent = config/* default.getCurrent */.Z.getCurrent(),
21788
21822
  MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY = _config$getCurrent.MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY;
21789
21823
 
21790
21824
  if (this._unsafelyBaseOnPreviousIndex === null || newElements.length < MIN_DASH_S_ELEMENTS_TO_PARSE_UNSAFELY) {
21791
21825
  // Just completely parse the current timeline
21792
- return constructTimelineFromElements(newElements, this._scaledPeriodStart);
21826
+ return constructTimelineFromElements(newElements, actualPeriodStart);
21793
21827
  } // Construct previously parsed timeline if not already done
21794
21828
 
21795
21829
 
@@ -21804,7 +21838,7 @@ var TimelineRepresentationIndex = /*#__PURE__*/function () {
21804
21838
 
21805
21839
  this._unsafelyBaseOnPreviousIndex = null; // Free memory
21806
21840
 
21807
- return constructTimelineFromPreviousTimeline(newElements, prevTimeline, this._scaledPeriodStart);
21841
+ return constructTimelineFromPreviousTimeline(newElements, prevTimeline, actualPeriodStart);
21808
21842
  };
21809
21843
 
21810
21844
  return TimelineRepresentationIndex;
@@ -22613,10 +22647,16 @@ function parseRepresentations(representationsIR, adaptation, context) {
22613
22647
  }
22614
22648
 
22615
22649
  if (cp.attributes.keyId !== undefined && cp.attributes.keyId.length > 0) {
22616
- acc.keyIds.push({
22650
+ var kidObj = {
22617
22651
  keyId: cp.attributes.keyId,
22618
22652
  systemId: systemId
22619
- });
22653
+ };
22654
+
22655
+ if (acc.keyIds === undefined) {
22656
+ acc.keyIds = [kidObj];
22657
+ } else {
22658
+ acc.keyIds.push(kidObj);
22659
+ }
22620
22660
  }
22621
22661
 
22622
22662
  if (systemId !== undefined) {
@@ -22651,11 +22691,11 @@ function parseRepresentations(representationsIR, adaptation, context) {
22651
22691
 
22652
22692
  return acc;
22653
22693
  }, {
22654
- keyIds: [],
22694
+ keyIds: undefined,
22655
22695
  initData: []
22656
22696
  });
22657
22697
 
22658
- if (Object.keys(contentProtections.initData).length > 0 || contentProtections.keyIds.length > 0) {
22698
+ if (Object.keys(contentProtections.initData).length > 0 || contentProtections.keyIds !== undefined && contentProtections.keyIds.length > 0) {
22659
22699
  parsedRepresentation.contentProtections = contentProtections;
22660
22700
  }
22661
22701
  }
@@ -28487,8 +28527,20 @@ function applyPadding(element, padding) {
28487
28527
  * @param {string|number} thickness
28488
28528
  * @returns {string}
28489
28529
  */
28530
+
28490
28531
  function generateCSSTextOutline(color, thickness) {
28491
- return "-1px -1px " + thickness + " " + color + "," + ("1px -1px " + thickness + " " + color + ",") + ("-1px 1px " + thickness + " " + color + ",") + ("1px 1px " + thickness + " " + color);
28532
+ var thick = thickness;
28533
+
28534
+ if ((0,is_non_empty_string/* default */.Z)(thickness) && thickness.trim().endsWith("%")) {
28535
+ // As em and % are basically equivalent in CSS
28536
+ // (they both are relative to the font-size
28537
+ // of the current element)
28538
+ // We convert the non supported % into the supported em
28539
+ thick = thickness.trim().slice(0, -1);
28540
+ thick = (parseInt(thick, 10) / 100).toString() + "em";
28541
+ }
28542
+
28543
+ return "-1px -1px " + thick + " " + color + "," + ("1px -1px " + thick + " " + color + ",") + ("-1px 1px " + thick + " " + color + ",") + ("1px 1px " + thick + " " + color);
28492
28544
  }
28493
28545
  ;// CONCATENATED MODULE: ./src/parsers/texttracks/ttml/html/ttml_color_to_css_color.ts
28494
28546
  /**
@@ -60992,7 +61044,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
60992
61044
  videoElement.preload = "auto";
60993
61045
  _this.version =
60994
61046
  /* PLAYER_VERSION */
60995
- "3.27.1-dev.2022041500";
61047
+ "3.27.1-dev.2022051100";
60996
61048
  _this.log = log/* default */.Z;
60997
61049
  _this.state = "STOPPED";
60998
61050
  _this.videoElement = videoElement;
@@ -63825,7 +63877,7 @@ var Player = /*#__PURE__*/function (_EventEmitter) {
63825
63877
 
63826
63878
  Player.version =
63827
63879
  /* PLAYER_VERSION */
63828
- "3.27.1-dev.2022041500";
63880
+ "3.27.1-dev.2022051100";
63829
63881
  /* harmony default export */ var public_api = (Player);
63830
63882
  ;// CONCATENATED MODULE: ./src/core/api/index.ts
63831
63883
  /**