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

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 (88) 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/cmcd/cmcd_data_builder.d.ts +12 -0
  12. package/dist/commonjs/core/cmcd/cmcd_data_builder.d.ts.map +1 -1
  13. package/dist/commonjs/core/cmcd/cmcd_data_builder.js +27 -1
  14. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts +24 -0
  15. package/dist/commonjs/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
  16. package/dist/commonjs/core/fetchers/segment/segment_queue.d.ts.map +1 -1
  17. package/dist/commonjs/core/fetchers/segment/segment_queue.js +8 -7
  18. package/dist/commonjs/core/main/worker/worker_main.js +4 -0
  19. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts.map +1 -1
  20. package/dist/commonjs/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +2 -2
  21. package/dist/commonjs/main_thread/api/public_api.js +2 -2
  22. package/dist/commonjs/parsers/manifest/dash/common/parse_mpd.js +2 -2
  23. package/dist/commonjs/parsers/manifest/dash/common/resolve_base_urls.js +2 -2
  24. package/dist/commonjs/parsers/manifest/metaplaylist/metaplaylist_parser.js +2 -2
  25. package/dist/commonjs/parsers/manifest/smooth/create_parser.js +2 -2
  26. package/dist/commonjs/transports/dash/construct_segment_url.js +2 -2
  27. package/dist/commonjs/transports/smooth/utils.js +2 -2
  28. package/dist/commonjs/utils/logger.d.ts.map +1 -1
  29. package/dist/commonjs/utils/logger.js +6 -7
  30. package/dist/commonjs/utils/{resolve_url.d.ts → url-utils.d.ts} +15 -4
  31. package/dist/commonjs/utils/url-utils.d.ts.map +1 -0
  32. package/dist/commonjs/utils/{resolve_url.js → url-utils.js} +71 -2
  33. package/dist/es2017/__GENERATED_CODE/embedded_worker.d.ts.map +1 -1
  34. package/dist/es2017/__GENERATED_CODE/embedded_worker.js +1 -1
  35. package/dist/es2017/compat/browser_detection.d.ts +3 -1
  36. package/dist/es2017/compat/browser_detection.d.ts.map +1 -1
  37. package/dist/es2017/compat/browser_detection.js +10 -1
  38. package/dist/es2017/compat/can_reuse_media_keys.d.ts +4 -0
  39. package/dist/es2017/compat/can_reuse_media_keys.d.ts.map +1 -1
  40. package/dist/es2017/compat/can_reuse_media_keys.js +6 -2
  41. package/dist/es2017/core/cmcd/cmcd_data_builder.d.ts +12 -0
  42. package/dist/es2017/core/cmcd/cmcd_data_builder.d.ts.map +1 -1
  43. package/dist/es2017/core/cmcd/cmcd_data_builder.js +27 -1
  44. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts +24 -0
  45. package/dist/es2017/core/fetchers/segment/segment_fetcher.d.ts.map +1 -1
  46. package/dist/es2017/core/fetchers/segment/segment_queue.d.ts.map +1 -1
  47. package/dist/es2017/core/fetchers/segment/segment_queue.js +8 -7
  48. package/dist/es2017/core/main/worker/worker_main.js +4 -0
  49. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.d.ts.map +1 -1
  50. package/dist/es2017/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.js +2 -2
  51. package/dist/es2017/main_thread/api/public_api.js +2 -2
  52. package/dist/es2017/parsers/manifest/dash/common/parse_mpd.js +1 -1
  53. package/dist/es2017/parsers/manifest/dash/common/resolve_base_urls.js +1 -1
  54. package/dist/es2017/parsers/manifest/metaplaylist/metaplaylist_parser.js +1 -1
  55. package/dist/es2017/parsers/manifest/smooth/create_parser.js +1 -1
  56. package/dist/es2017/transports/dash/construct_segment_url.js +1 -1
  57. package/dist/es2017/transports/smooth/utils.js +1 -1
  58. package/dist/es2017/utils/logger.d.ts.map +1 -1
  59. package/dist/es2017/utils/logger.js +6 -7
  60. package/dist/es2017/utils/{resolve_url.d.ts → url-utils.d.ts} +15 -4
  61. package/dist/es2017/utils/url-utils.d.ts.map +1 -0
  62. package/dist/es2017/utils/{resolve_url.js → url-utils.js} +71 -3
  63. package/dist/rx-player.js +253 -181
  64. package/dist/rx-player.min.js +18 -18
  65. package/dist/worker.js +8 -8
  66. package/package.json +5 -12
  67. package/src/README.md +7 -7
  68. package/src/__GENERATED_CODE/embedded_worker.ts +1 -1
  69. package/src/compat/__tests__/can_reuse_media_keys.test.ts +24 -1
  70. package/src/compat/browser_detection.ts +13 -4
  71. package/src/compat/can_reuse_media_keys.ts +6 -2
  72. package/src/core/cmcd/cmcd_data_builder.ts +68 -2
  73. package/src/core/fetchers/segment/segment_fetcher.ts +24 -0
  74. package/src/core/fetchers/segment/segment_queue.ts +11 -9
  75. package/src/core/main/worker/worker_main.ts +4 -0
  76. package/src/experimental/tools/VideoThumbnailLoader/video_thumbnail_loader.ts +8 -2
  77. package/src/main_thread/api/public_api.ts +2 -2
  78. package/src/parsers/manifest/dash/common/parse_mpd.ts +1 -1
  79. package/src/parsers/manifest/dash/common/resolve_base_urls.ts +1 -1
  80. package/src/parsers/manifest/metaplaylist/metaplaylist_parser.ts +1 -1
  81. package/src/parsers/manifest/smooth/create_parser.ts +1 -1
  82. package/src/transports/dash/construct_segment_url.ts +1 -1
  83. package/src/transports/smooth/utils.ts +1 -1
  84. package/src/utils/__tests__/{resolve_url.test.ts → url-utils.test.ts} +148 -1
  85. package/src/utils/logger.ts +6 -7
  86. package/src/utils/{resolve_url.ts → url-utils.ts} +83 -5
  87. package/dist/commonjs/utils/resolve_url.d.ts.map +0 -1
  88. package/dist/es2017/utils/resolve_url.d.ts.map +0 -1
package/dist/rx-player.js CHANGED
@@ -486,16 +486,15 @@
486
486
  this.info = level >= this._levels.INFO ? generateLogFn("info", console.info.bind(console)) : noop_default;
487
487
  this.debug = level >= this._levels.DEBUG ? generateLogFn("log", console.log.bind(console)) : noop_default;
488
488
  } else {
489
- const produceLogFn = (logLevel, namespace) => {
489
+ const produceLogFn = (logLevel) => {
490
490
  return level >= this._levels[logLevel] ? (...args) => {
491
- const now = monotonic_timestamp_default();
492
- return logFn(logLevel, [now, namespace, ...args]);
491
+ return logFn(logLevel, args);
493
492
  } : noop_default;
494
493
  };
495
- this.error = produceLogFn("ERROR", "error");
496
- this.warn = produceLogFn("WARNING", "warn");
497
- this.info = produceLogFn("INFO", "info");
498
- this.debug = produceLogFn("DEBUG", "log");
494
+ this.error = produceLogFn("ERROR");
495
+ this.warn = produceLogFn("WARNING");
496
+ this.info = produceLogFn("INFO");
497
+ this.debug = produceLogFn("DEBUG");
499
498
  }
500
499
  this.trigger("onLogLevelChange", {
501
500
  level: this._currentLevel,
@@ -578,6 +577,7 @@
578
577
  var isPlayStation4 = false;
579
578
  var isPlayStation5 = false;
580
579
  var isXbox = false;
580
+ var isA1KStb40xx = false;
581
581
  (function findCurrentBrowser() {
582
582
  var _a, _b, _c;
583
583
  if (is_node_default) {
@@ -629,6 +629,8 @@
629
629
  isPanasonic = true;
630
630
  } else if (navigator.userAgent.indexOf("Xbox") !== -1) {
631
631
  isXbox = true;
632
+ } else if (navigator.userAgent.indexOf("Model/a1-kstb40xx")) {
633
+ isA1KStb40xx = true;
632
634
  }
633
635
  })();
634
636
 
@@ -3372,6 +3374,213 @@
3372
3374
  });
3373
3375
  }
3374
3376
 
3377
+ // src/utils/starts_with.ts
3378
+ function startsWith(completeString, searchString, position) {
3379
+ if (typeof String.prototype.startsWith === "function") {
3380
+ return completeString.startsWith(searchString, position);
3381
+ }
3382
+ const initialPosition = typeof position === "number" ? Math.max(position, 0) : 0;
3383
+ return completeString.substring(initialPosition, initialPosition + searchString.length) === searchString;
3384
+ }
3385
+
3386
+ // src/utils/url-utils.ts
3387
+ var schemeRe = /^(?:[a-z]+:)?\/\//i;
3388
+ var urlComponentRegex = /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/;
3389
+ function getFilenameIndexInUrl(url) {
3390
+ const indexOfLastSlash = url.lastIndexOf("/");
3391
+ if (indexOfLastSlash < 0) {
3392
+ return url.length;
3393
+ }
3394
+ if (schemeRe.test(url)) {
3395
+ const firstSlashIndex = url.indexOf("/");
3396
+ if (firstSlashIndex >= 0 && indexOfLastSlash === firstSlashIndex + 1) {
3397
+ return url.length;
3398
+ }
3399
+ }
3400
+ const indexOfQuestionMark = url.indexOf("?");
3401
+ if (indexOfQuestionMark >= 0 && indexOfQuestionMark < indexOfLastSlash) {
3402
+ return getFilenameIndexInUrl(url.substring(0, indexOfQuestionMark));
3403
+ }
3404
+ return indexOfLastSlash + 1;
3405
+ }
3406
+ function getRelativeUrl(baseUrl, newUrl) {
3407
+ const baseParts = parseURL(baseUrl);
3408
+ const newParts = parseURL(newUrl);
3409
+ if (baseParts.scheme !== newParts.scheme || baseParts.authority !== newParts.authority) {
3410
+ return null;
3411
+ }
3412
+ if (
3413
+ // if base and new path are mixed between absolute and relative path, return null
3414
+ baseParts.path[0] !== void 0 && baseParts.path[0] !== "/" && newParts.path[0] === "/" || newParts.path[0] !== void 0 && newParts.path[0] !== "/" && baseParts.path[0] === "/"
3415
+ ) {
3416
+ return null;
3417
+ }
3418
+ const baseNormalizedPath = removeDotSegment(baseParts.path);
3419
+ const newNormalizedPath = removeDotSegment(newParts.path);
3420
+ let relativePath;
3421
+ if (baseNormalizedPath === newNormalizedPath) {
3422
+ relativePath = "";
3423
+ } else {
3424
+ const basePathSplitted = baseNormalizedPath.split("/");
3425
+ basePathSplitted.pop();
3426
+ const newPathSplitted = newNormalizedPath.split("/");
3427
+ while (basePathSplitted.length > 0 && newPathSplitted.length > 0 && basePathSplitted[0] === newPathSplitted[0]) {
3428
+ basePathSplitted.shift();
3429
+ newPathSplitted.shift();
3430
+ }
3431
+ while (basePathSplitted.length > 0) {
3432
+ basePathSplitted.shift();
3433
+ newPathSplitted.unshift("..");
3434
+ }
3435
+ let pathJoined = newPathSplitted.join("/");
3436
+ if (pathJoined.endsWith("../") || pathJoined.endsWith("./")) {
3437
+ pathJoined = pathJoined.slice(0, pathJoined.length - 1);
3438
+ }
3439
+ relativePath = pathJoined === "" ? "." : pathJoined;
3440
+ }
3441
+ let result = relativePath;
3442
+ if (relativePath === "" && newParts.query === baseParts.query) {
3443
+ } else if (newParts.query) {
3444
+ result += "?";
3445
+ result += newParts.query;
3446
+ }
3447
+ if (newParts.fragment) {
3448
+ result += "#";
3449
+ result += newParts.fragment;
3450
+ }
3451
+ return result;
3452
+ }
3453
+ function _resolveURL(base, relative) {
3454
+ const baseParts = parseURL(base);
3455
+ const relativeParts = parseURL(relative);
3456
+ if (relativeParts.scheme) {
3457
+ return formatURL(relativeParts);
3458
+ }
3459
+ const target = {
3460
+ scheme: baseParts.scheme,
3461
+ authority: baseParts.authority,
3462
+ path: "",
3463
+ query: relativeParts.query,
3464
+ fragment: relativeParts.fragment
3465
+ };
3466
+ if (relativeParts.authority) {
3467
+ target.authority = relativeParts.authority;
3468
+ target.path = removeDotSegment(relativeParts.path);
3469
+ return formatURL(target);
3470
+ }
3471
+ if (relativeParts.path === "") {
3472
+ target.path = baseParts.path;
3473
+ if (!relativeParts.query) {
3474
+ target.query = baseParts.query;
3475
+ }
3476
+ } else {
3477
+ if (startsWith(relativeParts.path, "/")) {
3478
+ target.path = removeDotSegment(relativeParts.path);
3479
+ } else {
3480
+ target.path = removeDotSegment(mergePaths(baseParts, relativeParts.path));
3481
+ }
3482
+ }
3483
+ return formatURL(target);
3484
+ }
3485
+ var parsedUrlCache = /* @__PURE__ */ new Map();
3486
+ var MAX_URL_CACHE_ENTRIES = 200;
3487
+ function parseURL(url) {
3488
+ var _a, _b, _c, _d, _e;
3489
+ if (parsedUrlCache.has(url)) {
3490
+ return parsedUrlCache.get(url);
3491
+ }
3492
+ const matches = url.match(urlComponentRegex);
3493
+ let parsed;
3494
+ if (matches === null) {
3495
+ parsed = {
3496
+ scheme: "",
3497
+ authority: "",
3498
+ path: "",
3499
+ query: "",
3500
+ fragment: ""
3501
+ };
3502
+ } else {
3503
+ parsed = {
3504
+ scheme: (_a = matches[1]) != null ? _a : "",
3505
+ authority: (_b = matches[2]) != null ? _b : "",
3506
+ path: (_c = matches[3]) != null ? _c : "",
3507
+ query: (_d = matches[4]) != null ? _d : "",
3508
+ fragment: (_e = matches[5]) != null ? _e : ""
3509
+ };
3510
+ }
3511
+ if (parsedUrlCache.size >= MAX_URL_CACHE_ENTRIES) {
3512
+ parsedUrlCache.clear();
3513
+ }
3514
+ parsedUrlCache.set(url, parsed);
3515
+ return parsed;
3516
+ }
3517
+ function formatURL(parts) {
3518
+ let url = "";
3519
+ if (parts.scheme) {
3520
+ url += parts.scheme + ":";
3521
+ }
3522
+ if (parts.authority) {
3523
+ url += "//" + parts.authority;
3524
+ }
3525
+ url += parts.path;
3526
+ if (parts.query) {
3527
+ url += "?" + parts.query;
3528
+ }
3529
+ if (parts.fragment) {
3530
+ url += "#" + parts.fragment;
3531
+ }
3532
+ return url;
3533
+ }
3534
+ function removeDotSegment(path) {
3535
+ const segments = path.split(/(?=\/)/);
3536
+ const output = [];
3537
+ for (let i = 0; i < segments.length; i++) {
3538
+ const segment = segments[i];
3539
+ if (segment === ".." || segment === "." || segment === "") {
3540
+ continue;
3541
+ }
3542
+ if (segment === "/..") {
3543
+ output.pop();
3544
+ if (i === segments.length - 1) {
3545
+ output.push("/");
3546
+ }
3547
+ continue;
3548
+ }
3549
+ if (segment === "/.") {
3550
+ if (i === segments.length - 1) {
3551
+ output.push("/");
3552
+ }
3553
+ continue;
3554
+ }
3555
+ output.push(segment);
3556
+ }
3557
+ return output.join("");
3558
+ }
3559
+ function mergePaths(baseParts, relativePath) {
3560
+ if (baseParts.authority && baseParts.path === "") {
3561
+ return "/" + relativePath;
3562
+ }
3563
+ const basePath = baseParts.path;
3564
+ return basePath.substring(0, basePath.lastIndexOf("/") + 1) + relativePath;
3565
+ }
3566
+ function resolveURL(...args) {
3567
+ var _a, _b, _c;
3568
+ const filteredArgs = args.filter((val) => val !== "");
3569
+ const len = filteredArgs.length;
3570
+ if (len === 0) {
3571
+ return "";
3572
+ }
3573
+ if (len === 1) {
3574
+ return (_a = filteredArgs[0]) != null ? _a : "";
3575
+ } else {
3576
+ const basePart = (_b = filteredArgs[0]) != null ? _b : "";
3577
+ const relativeParts = (_c = filteredArgs[1]) != null ? _c : "";
3578
+ const resolvedURL = _resolveURL(basePart, relativeParts);
3579
+ const remainingArgs = filteredArgs.slice(2);
3580
+ return resolveURL(resolvedURL, ...remainingArgs);
3581
+ }
3582
+ }
3583
+
3375
3584
  // src/core/cmcd/cmcd_data_builder.ts
3376
3585
  var RTP_FACTOR = 4;
3377
3586
  var CmcdDataBuilder = class {
@@ -3506,6 +3715,24 @@
3506
3715
  if (content.segment.isInit) {
3507
3716
  props.ot = "i";
3508
3717
  }
3718
+ if (!isNullOrUndefined(content.nextSegment) && content.segment.url !== null && content.nextSegment.url !== null) {
3719
+ if (!content.nextSegment.isInit || content.nextSegment.indexRange === void 0) {
3720
+ const currSegmentUrl = content.segment.url;
3721
+ const nextSegmentUrl = content.nextSegment.url;
3722
+ const relativeUrl = getRelativeUrl(currSegmentUrl, nextSegmentUrl);
3723
+ if (relativeUrl !== null) {
3724
+ if (relativeUrl !== ".") {
3725
+ props.nor = encodeURIComponent(relativeUrl);
3726
+ }
3727
+ if (content.nextSegment.range !== void 0) {
3728
+ props.nrr = String(content.nextSegment.range[0]) + "-";
3729
+ if (isFinite(content.nextSegment.range[1])) {
3730
+ props.nrr += String(content.nextSegment.range[1]);
3731
+ }
3732
+ }
3733
+ }
3734
+ }
3735
+ }
3509
3736
  let precizeBufferLengthMs;
3510
3737
  if (lastObservation !== void 0 && (props.ot === "v" || props.ot === "a" || props.ot === "av")) {
3511
3738
  const bufferedForType = lastObservation.buffered[content.adaptation.type];
@@ -3611,6 +3838,8 @@
3611
3838
  addNumberProperty("d", "object");
3612
3839
  addNumberProperty("dl", "request");
3613
3840
  addNumberProperty("mtp", "request");
3841
+ addStringProperty("nor", "request");
3842
+ addStringProperty("nrr", "request");
3614
3843
  addTokenProperty("ot", "object");
3615
3844
  addNumberProperty("pr", "session");
3616
3845
  addNumberProperty("rtp", "status");
@@ -6554,15 +6783,6 @@
6554
6783
  };
6555
6784
  }
6556
6785
 
6557
- // src/utils/starts_with.ts
6558
- function startsWith(completeString, searchString, position) {
6559
- if (typeof String.prototype.startsWith === "function") {
6560
- return completeString.startsWith(searchString, position);
6561
- }
6562
- const initialPosition = typeof position === "number" ? Math.max(position, 0) : 0;
6563
- return completeString.substring(initialPosition, initialPosition + searchString.length) === searchString;
6564
- }
6565
-
6566
6786
  // src/utils/byte_parsing.ts
6567
6787
  function concat(...args) {
6568
6788
  const l = args.length;
@@ -8144,7 +8364,7 @@
8144
8364
 
8145
8365
  // src/compat/can_reuse_media_keys.ts
8146
8366
  function canReuseMediaKeys() {
8147
- return !isWebOs && !isPhilipsNetTv && !isPanasonic;
8367
+ return !isWebOs && !isPhilipsNetTv && !isPanasonic && !isA1KStb40xx;
8148
8368
  }
8149
8369
 
8150
8370
  // src/compat/can_rely_on_request_media_key_system_access.ts
@@ -13287,9 +13507,10 @@
13287
13507
  contentInfo.mediaSegmentRequest.canceller.cancel();
13288
13508
  }
13289
13509
  const { downloadQueue, content, initSegmentInfoRef, currentCanceller } = contentInfo;
13290
- const { segmentQueue } = downloadQueue.getValue();
13291
- const currentNeededSegment = segmentQueue[0];
13292
- const recursivelyRequestSegments = (startingSegment) => {
13510
+ const recursivelyRequestSegments = () => {
13511
+ var _a;
13512
+ const { segmentQueue } = downloadQueue.getValue();
13513
+ const startingSegment = segmentQueue[0];
13293
13514
  if (currentCanceller !== null && currentCanceller.isUsed()) {
13294
13515
  contentInfo.mediaSegmentRequest = null;
13295
13516
  return;
@@ -13302,7 +13523,10 @@
13302
13523
  const canceller = new TaskCanceller();
13303
13524
  const unlinkCanceller = currentCanceller === null ? noop_default : canceller.linkToSignal(currentCanceller.signal);
13304
13525
  const { segment, priority } = startingSegment;
13305
- const context = object_assign_default({ segment }, content);
13526
+ const context = object_assign_default(
13527
+ { segment, nextSegment: (_a = segmentQueue[1]) == null ? void 0 : _a.segment },
13528
+ content
13529
+ );
13306
13530
  let isComplete = false;
13307
13531
  let isWaitingOnInitSegment = false;
13308
13532
  canceller.signal.register(() => {
@@ -13330,7 +13554,7 @@
13330
13554
  lastQueue.shift();
13331
13555
  }
13332
13556
  isComplete = true;
13333
- recursivelyRequestSegments(lastQueue[0]);
13557
+ recursivelyRequestSegments();
13334
13558
  };
13335
13559
  const request2 = this._segmentFetcher.createRequest(
13336
13560
  context,
@@ -13416,7 +13640,7 @@
13416
13640
  });
13417
13641
  contentInfo.mediaSegmentRequest = { segment, priority, request: request2, canceller };
13418
13642
  };
13419
- recursivelyRequestSegments(currentNeededSegment);
13643
+ recursivelyRequestSegments();
13420
13644
  }
13421
13645
  /**
13422
13646
  * Internal logic performing initialization segment requests.
@@ -13434,7 +13658,7 @@
13434
13658
  const canceller = new TaskCanceller();
13435
13659
  const unlinkCanceller = contentInfo.currentCanceller === null ? noop_default : canceller.linkToSignal(contentInfo.currentCanceller.signal);
13436
13660
  const { segment, priority } = queuedInitSegment;
13437
- const context = object_assign_default({ segment }, content);
13661
+ const context = object_assign_default({ segment, nextSegment: void 0 }, content);
13438
13662
  let isComplete = false;
13439
13663
  const request2 = this._segmentFetcher.createRequest(
13440
13664
  context,
@@ -23405,158 +23629,6 @@
23405
23629
  // src/parsers/manifest/dash/common/indexes/timeline/index.ts
23406
23630
  var timeline_default = TimelineRepresentationIndex;
23407
23631
 
23408
- // src/utils/resolve_url.ts
23409
- var schemeRe = /^(?:[a-z]+:)?\/\//i;
23410
- var urlComponentRegex = /^(?:([^:\/?#]+):)?(?:\/\/([^\/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?$/;
23411
- function getFilenameIndexInUrl(url) {
23412
- const indexOfLastSlash = url.lastIndexOf("/");
23413
- if (indexOfLastSlash < 0) {
23414
- return url.length;
23415
- }
23416
- if (schemeRe.test(url)) {
23417
- const firstSlashIndex = url.indexOf("/");
23418
- if (firstSlashIndex >= 0 && indexOfLastSlash === firstSlashIndex + 1) {
23419
- return url.length;
23420
- }
23421
- }
23422
- const indexOfQuestionMark = url.indexOf("?");
23423
- if (indexOfQuestionMark >= 0 && indexOfQuestionMark < indexOfLastSlash) {
23424
- return getFilenameIndexInUrl(url.substring(0, indexOfQuestionMark));
23425
- }
23426
- return indexOfLastSlash + 1;
23427
- }
23428
- function _resolveURL(base, relative) {
23429
- const baseParts = parseURL(base);
23430
- const relativeParts = parseURL(relative);
23431
- if (relativeParts.scheme) {
23432
- return formatURL(relativeParts);
23433
- }
23434
- const target = {
23435
- scheme: baseParts.scheme,
23436
- authority: baseParts.authority,
23437
- path: "",
23438
- query: relativeParts.query,
23439
- fragment: relativeParts.fragment
23440
- };
23441
- if (relativeParts.authority) {
23442
- target.authority = relativeParts.authority;
23443
- target.path = removeDotSegment(relativeParts.path);
23444
- return formatURL(target);
23445
- }
23446
- if (relativeParts.path === "") {
23447
- target.path = baseParts.path;
23448
- if (!relativeParts.query) {
23449
- target.query = baseParts.query;
23450
- }
23451
- } else {
23452
- if (startsWith(relativeParts.path, "/")) {
23453
- target.path = removeDotSegment(relativeParts.path);
23454
- } else {
23455
- target.path = removeDotSegment(mergePaths(baseParts, relativeParts.path));
23456
- }
23457
- }
23458
- return formatURL(target);
23459
- }
23460
- var parsedUrlCache = /* @__PURE__ */ new Map();
23461
- var MAX_URL_CACHE_ENTRIES = 200;
23462
- function parseURL(url) {
23463
- var _a, _b, _c, _d, _e;
23464
- if (parsedUrlCache.has(url)) {
23465
- return parsedUrlCache.get(url);
23466
- }
23467
- const matches = url.match(urlComponentRegex);
23468
- let parsed;
23469
- if (matches === null) {
23470
- parsed = {
23471
- scheme: "",
23472
- authority: "",
23473
- path: "",
23474
- query: "",
23475
- fragment: ""
23476
- };
23477
- } else {
23478
- parsed = {
23479
- scheme: (_a = matches[1]) != null ? _a : "",
23480
- authority: (_b = matches[2]) != null ? _b : "",
23481
- path: (_c = matches[3]) != null ? _c : "",
23482
- query: (_d = matches[4]) != null ? _d : "",
23483
- fragment: (_e = matches[5]) != null ? _e : ""
23484
- };
23485
- }
23486
- if (parsedUrlCache.size >= MAX_URL_CACHE_ENTRIES) {
23487
- parsedUrlCache.clear();
23488
- }
23489
- parsedUrlCache.set(url, parsed);
23490
- return parsed;
23491
- }
23492
- function formatURL(parts) {
23493
- let url = "";
23494
- if (parts.scheme) {
23495
- url += parts.scheme + ":";
23496
- }
23497
- if (parts.authority) {
23498
- url += "//" + parts.authority;
23499
- }
23500
- url += parts.path;
23501
- if (parts.query) {
23502
- url += "?" + parts.query;
23503
- }
23504
- if (parts.fragment) {
23505
- url += "#" + parts.fragment;
23506
- }
23507
- return url;
23508
- }
23509
- function removeDotSegment(path) {
23510
- const segments = path.split(/(?=\/)/);
23511
- const output = [];
23512
- for (let i = 0; i < segments.length; i++) {
23513
- const segment = segments[i];
23514
- if (segment === ".." || segment === "." || segment === "") {
23515
- continue;
23516
- }
23517
- if (segment === "/..") {
23518
- output.pop();
23519
- if (i === segments.length - 1) {
23520
- output.push("/");
23521
- }
23522
- continue;
23523
- }
23524
- if (segment === "/.") {
23525
- if (i === segments.length - 1) {
23526
- output.push("/");
23527
- }
23528
- continue;
23529
- }
23530
- output.push(segment);
23531
- }
23532
- return output.join("");
23533
- }
23534
- function mergePaths(baseParts, relativePath) {
23535
- if (baseParts.authority && baseParts.path === "") {
23536
- return "/" + relativePath;
23537
- }
23538
- const basePath = baseParts.path;
23539
- return basePath.substring(0, basePath.lastIndexOf("/") + 1) + relativePath;
23540
- }
23541
- function resolveURL(...args) {
23542
- var _a, _b, _c;
23543
- const filteredArgs = args.filter((val) => val !== "");
23544
- const len = filteredArgs.length;
23545
- if (len === 0) {
23546
- return "";
23547
- }
23548
- if (len === 1) {
23549
- return (_a = filteredArgs[0]) != null ? _a : "";
23550
- } else {
23551
- const basePart = (_b = filteredArgs[0]) != null ? _b : "";
23552
- const relativeParts = (_c = filteredArgs[1]) != null ? _c : "";
23553
- const resolvedURL = _resolveURL(basePart, relativeParts);
23554
- const remainingArgs = filteredArgs.slice(2);
23555
- return resolveURL(resolvedURL, ...remainingArgs);
23556
- }
23557
- }
23558
- var resolve_url_default = resolveURL;
23559
-
23560
23632
  // src/parsers/manifest/dash/common/content_protection_parser.ts
23561
23633
  var ContentProtectionParser = class {
23562
23634
  constructor() {
@@ -24315,7 +24387,7 @@
24315
24387
  const curBaseUrl = currentBaseURLs[i];
24316
24388
  for (let j = 0; j < newBaseUrls.length; j++) {
24317
24389
  const newBaseUrl = newBaseUrls[j];
24318
- const newUrl = resolve_url_default(curBaseUrl.url, newBaseUrl.url);
24390
+ const newUrl = resolveURL(curBaseUrl.url, newBaseUrl.url);
24319
24391
  result.push({
24320
24392
  url: newUrl,
24321
24393
  serviceLocation: (_a = newBaseUrl.serviceLocation) != null ? _a : curBaseUrl.serviceLocation
@@ -27099,7 +27171,7 @@
27099
27171
  if (segment.url === null) {
27100
27172
  return wantedCdn.baseUrl;
27101
27173
  }
27102
- return resolve_url_default(wantedCdn.baseUrl, segment.url);
27174
+ return resolveURL(wantedCdn.baseUrl, segment.url);
27103
27175
  }
27104
27176
 
27105
27177
  // src/transports/dash/init_segment_loader.ts
@@ -34172,7 +34244,7 @@
34172
34244
  if (segment.url === null) {
34173
34245
  return wantedCdn.baseUrl;
34174
34246
  }
34175
- return resolve_url_default(wantedCdn.baseUrl, segment.url);
34247
+ return resolveURL(wantedCdn.baseUrl, segment.url);
34176
34248
  }
34177
34249
 
34178
34250
  // src/transports/smooth/pipelines.ts
@@ -36776,7 +36848,7 @@ ${event}`
36776
36848
  } = parseConstructorOptions(options);
36777
36849
  videoElement.preload = "auto";
36778
36850
  this.version = /* PLAYER_VERSION */
36779
- "4.2.0-dev.2024090500";
36851
+ "4.2.0-dev.2024091000";
36780
36852
  this.log = log_default;
36781
36853
  this.state = "STOPPED";
36782
36854
  this.videoElement = videoElement;
@@ -39302,7 +39374,7 @@ ${event}`
39302
39374
  _Player._priv_currentlyUsedVideoElements = /* @__PURE__ */ new WeakSet();
39303
39375
  var Player = _Player;
39304
39376
  Player.version = /* PLAYER_VERSION */
39305
- "4.2.0-dev.2024090500";
39377
+ "4.2.0-dev.2024091000";
39306
39378
  var public_api_default = Player;
39307
39379
 
39308
39380
  // src/main_thread/api/index.ts