@volcengine/veplayer-plugin 2.12.0-rc.0 → 2.12.0-rc.2

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 (43) hide show
  1. package/esm/index.development.js +537 -246
  2. package/esm/index.production.js +3 -3
  3. package/esm/veplayer.plugin.abr.development.js +3 -1
  4. package/esm/veplayer.plugin.abr.production.js +1 -1
  5. package/esm/veplayer.plugin.ad.development.js +18 -4
  6. package/esm/veplayer.plugin.ad.production.js +2 -2
  7. package/esm/veplayer.plugin.drm.development.js +3 -1
  8. package/esm/veplayer.plugin.drm.production.js +1 -1
  9. package/esm/veplayer.plugin.flv.development.js +5 -3
  10. package/esm/veplayer.plugin.flv.production.js +1 -1
  11. package/esm/veplayer.plugin.hls.development.js +64 -14
  12. package/esm/veplayer.plugin.hls.production.js +1 -1
  13. package/esm/veplayer.plugin.hlsjs.development.js +3 -1
  14. package/esm/veplayer.plugin.hlsjs.production.js +1 -1
  15. package/esm/veplayer.plugin.mp4.development.js +9 -3
  16. package/esm/veplayer.plugin.mp4.production.js +1 -1
  17. package/esm/veplayer.plugin.rtm.development.js +293 -151
  18. package/esm/veplayer.plugin.rtm.production.js +1 -1
  19. package/esm/veplayer.plugin.shaka.development.js +8 -2
  20. package/esm/veplayer.plugin.shaka.production.js +2 -2
  21. package/esm/veplayer.strategy.base.development.js +163 -78
  22. package/esm/veplayer.strategy.base.production.js +1 -1
  23. package/package.json +1 -1
  24. package/umd/veplayer.plugin.abr.development.js +3 -1
  25. package/umd/veplayer.plugin.abr.production.js +1 -1
  26. package/umd/veplayer.plugin.ad.development.js +18 -4
  27. package/umd/veplayer.plugin.ad.production.js +1 -1
  28. package/umd/veplayer.plugin.drm.development.js +3 -1
  29. package/umd/veplayer.plugin.drm.production.js +1 -1
  30. package/umd/veplayer.plugin.flv.development.js +5 -3
  31. package/umd/veplayer.plugin.flv.production.js +1 -1
  32. package/umd/veplayer.plugin.hls.development.js +64 -14
  33. package/umd/veplayer.plugin.hls.production.js +1 -1
  34. package/umd/veplayer.plugin.hlsjs.development.js +3 -1
  35. package/umd/veplayer.plugin.hlsjs.production.js +1 -1
  36. package/umd/veplayer.plugin.mp4.development.js +9 -3
  37. package/umd/veplayer.plugin.mp4.production.js +1 -1
  38. package/umd/veplayer.plugin.rtm.development.js +293 -151
  39. package/umd/veplayer.plugin.rtm.production.js +1 -1
  40. package/umd/veplayer.plugin.shaka.development.js +8 -2
  41. package/umd/veplayer.plugin.shaka.production.js +1 -1
  42. package/umd/veplayer.strategy.base.development.js +163 -78
  43. package/umd/veplayer.strategy.base.production.js +1 -1
@@ -1644,7 +1644,7 @@
1644
1644
  }
1645
1645
  return offsetTime;
1646
1646
  };
1647
- var version = "3.0.21-rc.21";
1647
+ var version = "3.0.24-rc.6";
1648
1648
  var ERROR_MAP = {
1649
1649
  1: 5101,
1650
1650
  2: 5102,
@@ -1753,7 +1753,7 @@
1753
1753
  }
1754
1754
  if (this.__hooks && this.__hooks[hookName]) {
1755
1755
  try {
1756
- var preRet = runHooks(this, hookName, handler);
1756
+ var preRet = runHooks.apply(void 0, [this, hookName, handler].concat(Array.prototype.slice.call(arguments)));
1757
1757
  if (preRet) {
1758
1758
  if (preRet.then) {
1759
1759
  preRet.then(function(isContinue) {
@@ -1867,6 +1867,8 @@
1867
1867
  });
1868
1868
  } else if (ret !== false) {
1869
1869
  return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1870
+ } else if (ret === false) {
1871
+ return false;
1870
1872
  }
1871
1873
  };
1872
1874
  return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
@@ -3932,7 +3934,8 @@
3932
3934
  key: "isSupported",
3933
3935
  value: function isSupported() {
3934
3936
  var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
3935
- var MediaSource2 = getMediaSource();
3937
+ var preferMMS = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
3938
+ var MediaSource2 = getMediaSource(preferMMS);
3936
3939
  if (!MediaSource2)
3937
3940
  return false;
3938
3941
  try {
@@ -4128,6 +4131,7 @@
4128
4131
  _defineProperty$1(_assertThisInitialized$1(_this), "_running", false);
4129
4132
  _defineProperty$1(_assertThisInitialized$1(_this), "_logger", null);
4130
4133
  _defineProperty$1(_assertThisInitialized$1(_this), "_vid", "");
4134
+ _defineProperty$1(_assertThisInitialized$1(_this), "_firtstByte", 0);
4131
4135
  _defineProperty$1(_assertThisInitialized$1(_this), "_onProcessMinLen", 0);
4132
4136
  _defineProperty$1(_assertThisInitialized$1(_this), "_onCancel", null);
4133
4137
  _defineProperty$1(_assertThisInitialized$1(_this), "_priOptions", null);
@@ -4137,7 +4141,7 @@
4137
4141
  key: "load",
4138
4142
  value: function load(_ref) {
4139
4143
  var _this$_abortControlle, _this2 = this;
4140
- var url = _ref.url, vid = _ref.vid, timeout = _ref.timeout, responseType = _ref.responseType, onProgress = _ref.onProgress, index = _ref.index, onTimeout = _ref.onTimeout, onCancel = _ref.onCancel, range = _ref.range, transformResponse = _ref.transformResponse, request = _ref.request, params = _ref.params, logger2 = _ref.logger, method = _ref.method, headers = _ref.headers, body = _ref.body, mode = _ref.mode, credentials = _ref.credentials, cache = _ref.cache, redirect = _ref.redirect, referrer = _ref.referrer, referrerPolicy = _ref.referrerPolicy, onProcessMinLen = _ref.onProcessMinLen, priOptions = _ref.priOptions;
4144
+ var url = _ref.url, vid = _ref.vid, timeout = _ref.timeout, responseType = _ref.responseType, onProgress = _ref.onProgress, index = _ref.index, onTimeout = _ref.onTimeout, onCancel = _ref.onCancel, range = _ref.range, transformResponse = _ref.transformResponse, request = _ref.request, params = _ref.params, logger2 = _ref.logger, method = _ref.method, headers = _ref.headers, body = _ref.body, mode = _ref.mode, credentials = _ref.credentials, cache = _ref.cache, redirect = _ref.redirect, referrer = _ref.referrer, referrerPolicy = _ref.referrerPolicy, onProcessMinLen = _ref.onProcessMinLen, priOptions = _ref.priOptions, streamRes = _ref.streamRes, firstMaxChunkSize = _ref.firstMaxChunkSize;
4141
4145
  this._logger = logger2;
4142
4146
  this._aborted = false;
4143
4147
  this._onProcessMinLen = onProcessMinLen;
@@ -4148,6 +4152,7 @@
4148
4152
  this._range = range || [0, 0];
4149
4153
  this._vid = vid || url;
4150
4154
  this._priOptions = priOptions || {};
4155
+ this._firstMaxChunkSize = firstMaxChunkSize;
4151
4156
  var init = {
4152
4157
  method,
4153
4158
  headers,
@@ -4195,7 +4200,10 @@
4195
4200
  var startTime = Date.now();
4196
4201
  this._logger.debug("[fetch load start], index,", index, ",range,", range);
4197
4202
  return new Promise(function(resolve, reject) {
4198
- fetch(request || url, request ? void 0 : init).then(/* @__PURE__ */ function() {
4203
+ var promise = streamRes ? new Promise(function(r) {
4204
+ r(streamRes);
4205
+ }) : fetch(request || url, request ? void 0 : init);
4206
+ promise.then(/* @__PURE__ */ function() {
4199
4207
  var _ref2 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(response) {
4200
4208
  var firstByteTime, data, costTime, speed;
4201
4209
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -4391,7 +4399,7 @@
4391
4399
  var pump = /* @__PURE__ */ function() {
4392
4400
  var _ref3 = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee3() {
4393
4401
  var _this3$_range;
4394
- var startRange, startByte, curLen, retData, temp, costTime, speed;
4402
+ var startRange, startByte, curLen, retData, temp, tmp, _tmp, costTime, speed;
4395
4403
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
4396
4404
  while (1)
4397
4405
  switch (_context3.prev = _context3.next) {
@@ -4470,6 +4478,20 @@
4470
4478
  retData = data.value;
4471
4479
  }
4472
4480
  if (retData && retData.byteLength > 0 || data.done) {
4481
+ if (_this3._firstMaxChunkSize) {
4482
+ if (!_this3._firtstByte) {
4483
+ _this3._firtstByte++;
4484
+ tmp = retData.slice(0, _this3._firstMaxChunkSize);
4485
+ _this3._cacheData = retData.slice(_this3._firstMaxChunkSize);
4486
+ retData = tmp;
4487
+ } else if (_this3._cacheData) {
4488
+ _tmp = new Uint8Array(_this3._cacheData.byteLength + retData.byteLength);
4489
+ _tmp.set(_this3._cacheData, 0);
4490
+ _tmp.set(retData, _this3._cacheData.byteLength);
4491
+ retData = _tmp;
4492
+ _this3._cacheData = null;
4493
+ }
4494
+ }
4473
4495
  onProgress(retData, data.done, {
4474
4496
  range: [_this3._range[0] + _this3._receivedLength - (retData ? retData.byteLength : 0), _this3._range[0] + _this3._receivedLength],
4475
4497
  vid: _this3._vid,
@@ -4482,7 +4504,13 @@
4482
4504
  }, response);
4483
4505
  }
4484
4506
  if (!data.done) {
4485
- pump();
4507
+ if (_this3._firstMaxChunkSize) {
4508
+ setTimeout(function() {
4509
+ pump();
4510
+ }, 0);
4511
+ } else {
4512
+ pump();
4513
+ }
4486
4514
  } else {
4487
4515
  costTime = Date.now() - st;
4488
4516
  speed = calculateSpeed(_this3._receivedLength, costTime);
@@ -6204,7 +6232,7 @@
6204
6232
  objectType = 2;
6205
6233
  extensionSamplingIndex = samplingIndex;
6206
6234
  } else {
6207
- objectType = originObjectType === 2 || originObjectType === 5 ? originObjectType : 5;
6235
+ objectType = 5;
6208
6236
  extensionSamplingIndex = samplingIndex;
6209
6237
  if (samplingIndex >= 6) {
6210
6238
  extensionSamplingIndex = samplingIndex - 3;
@@ -7137,7 +7165,7 @@
7137
7165
  x.pts += vDelta;
7138
7166
  });
7139
7167
  } else {
7140
- for (var i = 1; i < len - 1; i++) {
7168
+ for (var i = 1; i <= len - 1; i++) {
7141
7169
  var _samples$i;
7142
7170
  var dts = (_samples$i = samples[i]) === null || _samples$i === void 0 ? void 0 : _samples$i.dts;
7143
7171
  var prevDts = samples[i - 1].dts;
@@ -8697,6 +8725,13 @@
8697
8725
  }
8698
8726
  ret.objectType = objectType;
8699
8727
  ret.codec += objectType.toString(16);
8728
+ if (/^mp4a/ig.test(ret.codec) && config.length >= 2) {
8729
+ var samplingFrequencyIndex = (config[0] & 7) << 1 | (config[1] & 128) >> 7;
8730
+ ret.samplingFrequencyIndex = samplingFrequencyIndex;
8731
+ if (samplingFrequencyIndex < AAC.FREQ.length) {
8732
+ ret.sampleRate = AAC.FREQ[samplingFrequencyIndex];
8733
+ }
8734
+ }
8700
8735
  if (ret.codec[ret.codec.length - 1] === ".") {
8701
8736
  ret.codec = ret.codec.substring(0, ret.codec.length - 1);
8702
8737
  }
@@ -8985,7 +9020,9 @@
8985
9020
  v.codecType = VideoCodecType.AV1;
8986
9021
  v.codec = e1.av1C.codec;
8987
9022
  v.av1C = e1.av1C.data;
8988
- v.colr = e1.colr.data;
9023
+ if (e1.colr) {
9024
+ v.colr = e1.colr.data;
9025
+ }
8989
9026
  } else if (e1.hvcC) {
8990
9027
  v.codecType = VideoCodecType.HEVC;
8991
9028
  v.codec = e1.hvcC.codec;
@@ -9031,7 +9068,7 @@
9031
9068
  a.duration = aTrack.mdia.mdhd.duration || a.mvhdDurtion / a.mvhdTimecale * a.timescale;
9032
9069
  var _e = aTrack.mdia.minf.stbl.stsd.entries[0];
9033
9070
  a.sampleSize = _e.sampleSize;
9034
- a.sampleRate = _e.sampleRate;
9071
+ a.sampleRate = getAudioSampleRate(_e);
9035
9072
  a.channelCount = _e.channelCount;
9036
9073
  a.present = true;
9037
9074
  switch (_e.type) {
@@ -9214,6 +9251,19 @@
9214
9251
  }]);
9215
9252
  return MP4Parser2;
9216
9253
  }();
9254
+ function getAudioSampleRate(audioSampleEntry) {
9255
+ var sampleRate = 0;
9256
+ if (audioSampleEntry.type === "mp4a") {
9257
+ if (audioSampleEntry.sampleRate > 0) {
9258
+ sampleRate = audioSampleEntry.sampleRate;
9259
+ } else {
9260
+ sampleRate = audioSampleEntry.esds.sampleRate;
9261
+ }
9262
+ } else {
9263
+ sampleRate = audioSampleEntry.sampleRate;
9264
+ }
9265
+ return sampleRate || 0;
9266
+ }
9217
9267
  function getSamples(stts, stsc, stsz, stco, ctts, stss) {
9218
9268
  var samples = [];
9219
9269
  var cttsEntries = ctts === null || ctts === void 0 ? void 0 : ctts.entries;
@@ -14564,7 +14614,7 @@
14564
14614
  if (!_this.media)
14565
14615
  return;
14566
14616
  var cfg = _this.config;
14567
- if (cfg.isLive && cfg.maxLatency && cfg.targetLatency && _this.media) {
14617
+ if (cfg.isLive && cfg.maxLatency && cfg.targetLatency) {
14568
14618
  var liveEdge = _this._playlist.liveEdge;
14569
14619
  if (!liveEdge)
14570
14620
  return;
@@ -14578,7 +14628,7 @@
14578
14628
  var _this$_seiService;
14579
14629
  (_this$_seiService = _this._seiService) === null || _this$_seiService === void 0 ? void 0 : _this$_seiService.throw(_this.media.currentTime);
14580
14630
  }
14581
- if (_this.config.allowedStreamTrackChange && !_this.config.softDecode) {
14631
+ if (cfg.allowedStreamTrackChange && !cfg.softDecode && _this.media.readyState) {
14582
14632
  _this._checkStreamTrackChange(_this.media.currentTime);
14583
14633
  }
14584
14634
  });
@@ -15756,7 +15806,7 @@
15756
15806
  }]);
15757
15807
  return Hls2;
15758
15808
  }(EventEmitter);
15759
- _defineProperty$3(Hls, "version", "3.0.21-rc.21");
15809
+ _defineProperty$3(Hls, "version", "3.0.24-rc.2");
15760
15810
  try {
15761
15811
  if (localStorage.getItem("xgd")) {
15762
15812
  Hls.enableLogger();