@volcengine/veplayer-plugin 2.4.1-rc.0 → 2.5.0-rc.0

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.d.ts +1 -0
  2. package/esm/index.development.css +7 -0
  3. package/esm/index.development.js +31562 -23809
  4. package/esm/index.production.css +1 -1
  5. package/esm/index.production.js +13 -4
  6. package/esm/veplayer.plugin.abr.development.js +59 -3
  7. package/esm/veplayer.plugin.abr.production.js +1 -1
  8. package/esm/veplayer.plugin.ad.development.css +7 -0
  9. package/esm/veplayer.plugin.ad.development.js +9042 -0
  10. package/esm/veplayer.plugin.ad.production.css +1 -0
  11. package/esm/veplayer.plugin.ad.production.js +4 -0
  12. package/esm/veplayer.plugin.drm.development.js +59 -3
  13. package/esm/veplayer.plugin.drm.production.js +1 -1
  14. package/esm/veplayer.plugin.flv.development.js +63 -22
  15. package/esm/veplayer.plugin.flv.production.js +1 -1
  16. package/esm/veplayer.plugin.hls.development.js +398 -55
  17. package/esm/veplayer.plugin.hls.production.js +1 -1
  18. package/esm/veplayer.plugin.mp4.development.js +61 -5
  19. package/esm/veplayer.plugin.mp4.production.js +1 -1
  20. package/esm/veplayer.plugin.rtm.development.js +63 -13
  21. package/esm/veplayer.plugin.rtm.production.js +1 -1
  22. package/esm/veplayer.plugin.shaka.development.js +60 -4
  23. package/esm/veplayer.plugin.shaka.production.js +1 -1
  24. package/package.json +1 -1
  25. package/umd/index.d.ts +1 -0
  26. package/umd/veplayer.plugin.abr.development.js +59 -3
  27. package/umd/veplayer.plugin.abr.production.js +1 -1
  28. package/umd/veplayer.plugin.ad.development.css +7 -0
  29. package/umd/veplayer.plugin.ad.development.js +9045 -0
  30. package/umd/veplayer.plugin.ad.production.css +1 -0
  31. package/umd/veplayer.plugin.ad.production.js +1 -0
  32. package/umd/veplayer.plugin.drm.development.js +59 -3
  33. package/umd/veplayer.plugin.drm.production.js +1 -1
  34. package/umd/veplayer.plugin.flv.development.js +63 -22
  35. package/umd/veplayer.plugin.flv.production.js +1 -1
  36. package/umd/veplayer.plugin.hls.development.js +398 -55
  37. package/umd/veplayer.plugin.hls.production.js +1 -1
  38. package/umd/veplayer.plugin.mp4.development.js +61 -5
  39. package/umd/veplayer.plugin.mp4.production.js +1 -1
  40. package/umd/veplayer.plugin.rtm.development.js +63 -13
  41. package/umd/veplayer.plugin.rtm.production.js +1 -1
  42. package/umd/veplayer.plugin.shaka.development.js +60 -4
  43. package/umd/veplayer.plugin.shaka.production.js +1 -1
@@ -1530,7 +1530,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
1530
1530
  }
1531
1531
  return offsetTime;
1532
1532
  };
1533
- var version = "3.0.19-rc.0";
1533
+ var version = "3.0.20-alpha.4";
1534
1534
  var ERROR_MAP = {
1535
1535
  1: 5101,
1536
1536
  2: 5102,
@@ -1638,8 +1638,7 @@ function hook(hookName, handler) {
1638
1638
  }
1639
1639
  if (this.__hooks && this.__hooks[hookName]) {
1640
1640
  try {
1641
- var _this$__hooks$hookNam;
1642
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
1641
+ var preRet = runHooks(this, hookName, handler);
1643
1642
  if (preRet) {
1644
1643
  if (preRet.then) {
1645
1644
  preRet.then(function(isContinue) {
@@ -1664,6 +1663,19 @@ function hook(hookName, handler) {
1664
1663
  }
1665
1664
  }.bind(this);
1666
1665
  }
1666
+ function findHookIndex(hookName, handler) {
1667
+ var __hooks = this.__hooks;
1668
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
1669
+ return -1;
1670
+ }
1671
+ var hookHandlers = __hooks[hookName];
1672
+ for (var i = 0; i < hookHandlers.length; i++) {
1673
+ if (hookHandlers[i] === handler) {
1674
+ return i;
1675
+ }
1676
+ }
1677
+ return -1;
1678
+ }
1667
1679
  function useHooks(hookName, handler) {
1668
1680
  var __hooks = this.__hooks;
1669
1681
  if (!__hooks) {
@@ -1673,7 +1685,12 @@ function useHooks(hookName, handler) {
1673
1685
  console.warn("has no supported hook which name [".concat(hookName, "]"));
1674
1686
  return false;
1675
1687
  }
1676
- __hooks && (__hooks[hookName] = handler);
1688
+ if (!Array.isArray(__hooks[hookName])) {
1689
+ __hooks[hookName] = [];
1690
+ }
1691
+ if (findHookIndex.call(this, hookName, handler) === -1) {
1692
+ __hooks[hookName].push(handler);
1693
+ }
1677
1694
  return true;
1678
1695
  }
1679
1696
  function removeHooks(hookName, handler) {
@@ -1681,6 +1698,13 @@ function removeHooks(hookName, handler) {
1681
1698
  if (!__hooks) {
1682
1699
  return;
1683
1700
  }
1701
+ if (Array.isArray(__hooks[hookName])) {
1702
+ var hooks = __hooks[hookName];
1703
+ var index = findHookIndex.call(this, hookName, handler);
1704
+ if (index !== -1) {
1705
+ hooks.splice(index, 1);
1706
+ }
1707
+ }
1684
1708
  delete __hooks[hookName];
1685
1709
  }
1686
1710
  function hooksDescriptor(instance) {
@@ -1702,6 +1726,38 @@ function hooksDescriptor(instance) {
1702
1726
  function delHooksDescriptor(instance) {
1703
1727
  instance.__hooks = null;
1704
1728
  }
1729
+ function runHooks(obj, hookName, handler) {
1730
+ for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1731
+ args[_key5 - 3] = arguments[_key5];
1732
+ }
1733
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
1734
+ var hooks = obj.__hooks[hookName];
1735
+ var index = -1;
1736
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
1737
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1738
+ args2[_key6 - 3] = arguments[_key6];
1739
+ }
1740
+ index++;
1741
+ if (hooks.length === 0 || index === hooks.length) {
1742
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1743
+ }
1744
+ var hook2 = hooks[index];
1745
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1746
+ if (ret && ret.then) {
1747
+ return ret.then(function(data) {
1748
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1749
+ }).catch(function(e) {
1750
+ console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1751
+ });
1752
+ } else if (ret !== false) {
1753
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1754
+ }
1755
+ };
1756
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1757
+ } else {
1758
+ return handler.call.apply(handler, [obj, obj].concat(args));
1759
+ }
1760
+ }
1705
1761
  function showErrorMsg(pluginName, msg) {
1706
1762
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1707
1763
  }
@@ -5597,7 +5653,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
5597
5653
  }, {
5598
5654
  key: "version",
5599
5655
  get: function get() {
5600
- return "0.2.1-alpha.1";
5656
+ return "0.2.1-alpha.0";
5601
5657
  }
5602
5658
  }, {
5603
5659
  key: "beforePlayerInit",
@@ -5693,14 +5749,8 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
5693
5749
  }
5694
5750
  player.config.url = backupURL;
5695
5751
  if (backupConstruct) {
5696
- if (!Array.isArray(backupConstruct)) {
5697
- backupConstruct = [backupConstruct];
5698
- }
5699
- backupConstruct.forEach(function(construct) {
5700
- var _newPlugin$beforePlay;
5701
- var newPlugin = player.registerPlugin(construct);
5702
- (_newPlugin$beforePlay = newPlugin.beforePlayerInit) === null || _newPlugin$beforePlay === void 0 ? void 0 : _newPlugin$beforePlay.call(newPlugin);
5703
- });
5752
+ var newPlugin = player.registerPlugin(backupConstruct);
5753
+ newPlugin.beforePlayerInit();
5704
5754
  } else {
5705
5755
  player.video.src = backupURL;
5706
5756
  }