@volcengine/veplayer-plugin 2.4.3-rc.0 → 2.4.3-rc.1

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.
@@ -42808,6 +42808,31 @@ var MediaSegmentKey = /* @__PURE__ */ function() {
42808
42808
  }]);
42809
42809
  return MediaSegmentKey2;
42810
42810
  }();
42811
+ var HlsUrlParameters = /* @__PURE__ */ function() {
42812
+ function HlsUrlParameters2(msn, part, skip) {
42813
+ _classCallCheck$c(this, HlsUrlParameters2);
42814
+ this.msn = msn;
42815
+ this.part = part;
42816
+ this.skip = skip;
42817
+ }
42818
+ _createClass$c(HlsUrlParameters2, [{
42819
+ key: "addDirectives",
42820
+ value: function addDirectives(uri) {
42821
+ var url = new self.URL(uri);
42822
+ if (this.msn !== void 0) {
42823
+ url.searchParams.set("_HLS_msn", this.msn.toString());
42824
+ }
42825
+ if (this.part) {
42826
+ url.searchParams.set("_HLS_part", this.part.toString());
42827
+ }
42828
+ if (this.skip) {
42829
+ url.searchParams.set("_HLS_skip", this.skip);
42830
+ }
42831
+ return url.href;
42832
+ }
42833
+ }]);
42834
+ return HlsUrlParameters2;
42835
+ }();
42811
42836
  var REGEXP_TAG = /^#(EXT[^:]*)(?::(.*))?$/;
42812
42837
  var REGEXP_ATTR = /([^=]+)=(?:"([^"]*)"|([^",]*))(?:,|$)/g;
42813
42838
  var REGEXP_ABSOLUTE_URL = /^(?:[a-zA-Z0-9+\-.]+:)?\/\//;
@@ -43046,7 +43071,7 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43046
43071
  media.canBlockReload = _attr["CAN-BLOCK-RELOAD"] === "YES";
43047
43072
  media.partHoldBack = parseFloat(_attr["PART-HOLD-BACK"] || 0);
43048
43073
  media.canSkipUntil = parseFloat(_attr["CAN-SKIP-UNTIL"] || 0);
43049
- media.canSkipDateRanges = _attr["CAN-SKIP-DATERANGES"] === "YES";
43074
+ media.canSkipDateRanges = media.canSkipUntil > 0 && _attr["CAN-SKIP-DATERANGES"] === "YES";
43050
43075
  }
43051
43076
  break;
43052
43077
  case "ENDLIST":
@@ -43090,6 +43115,15 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43090
43115
  }
43091
43116
  break;
43092
43117
  case "PRELOAD-HINT":
43118
+ {
43119
+ var _attr3 = parseAttr(data2);
43120
+ media.preloadHint = _attr3;
43121
+ if (_attr3["TYPE"] === "PART" && _attr3["URI"]) {
43122
+ var tmp = _attr3["URI"].split(".ts")[0].split("-");
43123
+ media.nextSN = tmp[3];
43124
+ media.nextIndex = tmp[tmp.length - 1];
43125
+ }
43126
+ }
43093
43127
  break;
43094
43128
  case "PROGRAM-DATE-TIME":
43095
43129
  curSegment.dataTime = data2;
@@ -43109,21 +43143,21 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43109
43143
  break;
43110
43144
  case "KEY":
43111
43145
  {
43112
- var _attr3 = parseAttr(data2);
43113
- if (_attr3.METHOD === "NONE") {
43146
+ var _attr4 = parseAttr(data2);
43147
+ if (_attr4.METHOD === "NONE") {
43114
43148
  curKey = null;
43115
43149
  break;
43116
43150
  }
43117
43151
  curKey = new MediaSegmentKey();
43118
- curKey.method = _attr3.METHOD;
43119
- curKey.url = /^blob:/.test(_attr3.URI) ? _attr3.URI : getAbsoluteUrl(_attr3.URI, parentUrl);
43120
- curKey.keyFormat = _attr3.KEYFORMAT || "identity";
43121
- curKey.keyFormatVersions = _attr3.KEYFORMATVERSIONS;
43152
+ curKey.method = _attr4.METHOD;
43153
+ curKey.url = /^blob:/.test(_attr4.URI) ? _attr4.URI : getAbsoluteUrl(_attr4.URI, parentUrl);
43154
+ curKey.keyFormat = _attr4.KEYFORMAT || "identity";
43155
+ curKey.keyFormatVersions = _attr4.KEYFORMATVERSIONS;
43122
43156
  if (!curKey.isSupported()) {
43123
- throw new Error("encrypt ".concat(_attr3.METHOD, "/").concat(_attr3.KEYFORMAT, " is not supported"));
43157
+ throw new Error("encrypt ".concat(_attr4.METHOD, "/").concat(_attr4.KEYFORMAT, " is not supported"));
43124
43158
  }
43125
- if (_attr3.IV) {
43126
- var str2 = _attr3.IV.slice(2);
43159
+ if (_attr4.IV) {
43160
+ var str2 = _attr4.IV.slice(2);
43127
43161
  str2 = (str2.length & 1 ? "0" : "") + str2;
43128
43162
  curKey.iv = new Uint8Array(str2.length / 2);
43129
43163
  for (var i = 0, l = str2.length / 2; i < l; i++) {
@@ -43134,10 +43168,10 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43134
43168
  break;
43135
43169
  case "MAP":
43136
43170
  {
43137
- var _attr4 = parseAttr(data2);
43138
- curSegment.url = getAbsoluteUrl(_attr4.URI, parentUrl);
43139
- if (_attr4.BYTERANGE)
43140
- curSegment.setByteRange(_attr4.BYTERANGE);
43171
+ var _attr5 = parseAttr(data2);
43172
+ curSegment.url = getAbsoluteUrl(_attr5.URI, parentUrl);
43173
+ if (_attr5.BYTERANGE)
43174
+ curSegment.setByteRange(_attr5.BYTERANGE);
43141
43175
  curSegment.isInitSegment = true;
43142
43176
  curSegment.sn = 0;
43143
43177
  if (curKey) {
@@ -43149,24 +43183,25 @@ function parseMediaPlaylist(lines, parentUrl, useLowLatency) {
43149
43183
  break;
43150
43184
  case "SKIP":
43151
43185
  {
43152
- var _attr5 = parseAttr(data2);
43153
- var skippedSegments = parseInt(_attr5["SKIPPED-SEGMENTS"], 10);
43186
+ var _attr6 = parseAttr(data2);
43187
+ var skippedSegments = parseInt(_attr6["SKIPPED-SEGMENTS"], 10);
43154
43188
  if (skippedSegments <= Number.MAX_SAFE_INTEGER) {
43155
43189
  media.skippedSegments += skippedSegments;
43190
+ curSN += skippedSegments;
43156
43191
  }
43157
43192
  }
43158
43193
  break;
43159
43194
  case "DATERANGE":
43160
43195
  {
43161
- var _attr6 = parseAttr(data2);
43162
- var dateRangeWithSameId = media.dateRanges[_attr6.ID];
43163
- _attr6._startDate = dateRangeWithSameId ? dateRangeWithSameId._startDate : new Date(_attr6["START-DATE"]);
43164
- var endDate = (dateRangeWithSameId === null || dateRangeWithSameId === void 0 ? void 0 : dateRangeWithSameId._endDate) || new Date(_attr6.END_DATE);
43196
+ var _attr7 = parseAttr(data2);
43197
+ var dateRangeWithSameId = media.dateRanges[_attr7.ID];
43198
+ _attr7._startDate = dateRangeWithSameId ? dateRangeWithSameId._startDate : new Date(_attr7["START-DATE"]);
43199
+ var endDate = (dateRangeWithSameId === null || dateRangeWithSameId === void 0 ? void 0 : dateRangeWithSameId._endDate) || new Date(_attr7.END_DATE);
43165
43200
  if (Number.isFinite(endDate)) {
43166
- _attr6._endDate = endDate;
43201
+ _attr7._endDate = endDate;
43167
43202
  }
43168
- if (isValidDaterange(_attr6, dateRangeWithSameId) || media.skippedSegments) {
43169
- media.dateRanges[_attr6.ID] = _attr6;
43203
+ if (isValidDaterange(_attr7, dateRangeWithSameId) || media.skippedSegments) {
43204
+ media.dateRanges[_attr7.ID] = _attr7;
43170
43205
  }
43171
43206
  }
43172
43207
  break;
@@ -43363,6 +43398,13 @@ var ManifestLoader = /* @__PURE__ */ function() {
43363
43398
  playlist
43364
43399
  });
43365
43400
  } else {
43401
+ if (this._useLowLatency) {
43402
+ if (playlist.canBlockReload) {
43403
+ this.deliveryDirectives = new HlsUrlParameters(playlist.nextSN, playlist.nextIndex, "");
43404
+ } else {
43405
+ this.deliveryDirectives = null;
43406
+ }
43407
+ }
43366
43408
  this.hls.emit(Event$1.HLS_LEVEL_LOADED, {
43367
43409
  playlist
43368
43410
  });
@@ -43419,41 +43461,45 @@ var ManifestLoader = /* @__PURE__ */ function() {
43419
43461
  var retryCount = this.hls.config.pollRetryCount;
43420
43462
  var fn = /* @__PURE__ */ function() {
43421
43463
  var _ref2 = _asyncToGenerator$6(/* @__PURE__ */ _regeneratorRuntime$6().mark(function _callee2() {
43422
- var res;
43464
+ var reqUrl, res;
43423
43465
  return _regeneratorRuntime$6().wrap(function _callee2$(_context2) {
43424
43466
  while (1)
43425
43467
  switch (_context2.prev = _context2.next) {
43426
43468
  case 0:
43427
43469
  clearTimeout(_this2._timer);
43428
- _context2.prev = 1;
43429
- _context2.next = 4;
43430
- return _this2.load(url, audioUrl, subtitleUrl);
43431
- case 4:
43470
+ reqUrl = url;
43471
+ _context2.prev = 2;
43472
+ if (_this2.deliveryDirectives) {
43473
+ reqUrl = _this2.deliveryDirectives.addDirectives(url);
43474
+ }
43475
+ _context2.next = 6;
43476
+ return _this2.load(reqUrl, audioUrl, subtitleUrl);
43477
+ case 6:
43432
43478
  res = _context2.sent;
43433
43479
  if (res[0]) {
43434
- _context2.next = 7;
43480
+ _context2.next = 9;
43435
43481
  break;
43436
43482
  }
43437
43483
  return _context2.abrupt("return");
43438
- case 7:
43484
+ case 9:
43439
43485
  retryCount = _this2.hls.config.pollRetryCount;
43440
43486
  cb(res[0], res[1], res[2]);
43441
- _context2.next = 15;
43487
+ _context2.next = 17;
43442
43488
  break;
43443
- case 11:
43444
- _context2.prev = 11;
43445
- _context2.t0 = _context2["catch"](1);
43489
+ case 13:
43490
+ _context2.prev = 13;
43491
+ _context2.t0 = _context2["catch"](2);
43446
43492
  retryCount--;
43447
43493
  if (retryCount <= 0) {
43448
43494
  errorCb(_context2.t0);
43449
43495
  }
43450
- case 15:
43496
+ case 17:
43451
43497
  _this2._timer = setTimeout(fn, time);
43452
- case 16:
43498
+ case 18:
43453
43499
  case "end":
43454
43500
  return _context2.stop();
43455
43501
  }
43456
- }, _callee2, null, [[1, 11]]);
43502
+ }, _callee2, null, [[2, 13]]);
43457
43503
  }));
43458
43504
  return function fn2() {
43459
43505
  return _ref2.apply(this, arguments);
@@ -43983,7 +44029,7 @@ var Playlist = /* @__PURE__ */ function() {
43983
44029
  }, {
43984
44030
  key: "clearOldSegment",
43985
44031
  value: function clearOldSegment() {
43986
- var maxPlaylistSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 50;
44032
+ var maxPlaylistSize = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.hls.config.maxPlaylistSize || 50;
43987
44033
  var stream = this.currentStream;
43988
44034
  if (!this.dvrWindow || !stream)
43989
44035
  return;
@@ -44494,7 +44540,6 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44494
44540
  return;
44495
44541
  _this._startTick();
44496
44542
  var media = _this.media;
44497
- var buffered = Buffer$4.get(media);
44498
44543
  var segLoaderError = _this._segmentLoader.error;
44499
44544
  _this._onCheckQuotaExceeded();
44500
44545
  if (_this._isProcessQuotaExceeded) {
@@ -44511,7 +44556,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
44511
44556
  }
44512
44557
  return;
44513
44558
  }
44514
- if (Buffer$4.end(buffered) >= 0.1 && media.readyState) {
44559
+ if (media.readyState) {
44515
44560
  if (isMediaPlaying(media)) {
44516
44561
  _this._loadSegment();
44517
44562
  if (_this._gapService) {
@@ -45664,7 +45709,7 @@ var Hls = /* @__PURE__ */ function(_EventEmitter) {
45664
45709
  }]);
45665
45710
  return Hls2;
45666
45711
  }(EventEmitter$1);
45667
- _defineProperty$a(Hls, "version", "3.0.20-rc.6");
45712
+ _defineProperty$a(Hls, "version", "3.0.20-alpha.3");
45668
45713
  try {
45669
45714
  if (localStorage.getItem("xgd")) {
45670
45715
  Hls.enableLogger();