@volcengine/veplayer-plugin 2.4.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 +31315 -23541
  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 +60 -4
  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 +60 -4
  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 +60 -4
  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 +60 -4
  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
@@ -1534,7 +1534,7 @@
1534
1534
  }
1535
1535
  return offsetTime;
1536
1536
  };
1537
- var version = "3.0.19-rc.0";
1537
+ var version = "3.0.20-alpha.4";
1538
1538
  var ERROR_MAP = {
1539
1539
  1: 5101,
1540
1540
  2: 5102,
@@ -1642,8 +1642,7 @@
1642
1642
  }
1643
1643
  if (this.__hooks && this.__hooks[hookName]) {
1644
1644
  try {
1645
- var _this$__hooks$hookNam;
1646
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
1645
+ var preRet = runHooks(this, hookName, handler);
1647
1646
  if (preRet) {
1648
1647
  if (preRet.then) {
1649
1648
  preRet.then(function(isContinue) {
@@ -1668,6 +1667,19 @@
1668
1667
  }
1669
1668
  }.bind(this);
1670
1669
  }
1670
+ function findHookIndex(hookName, handler) {
1671
+ var __hooks = this.__hooks;
1672
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
1673
+ return -1;
1674
+ }
1675
+ var hookHandlers = __hooks[hookName];
1676
+ for (var i = 0; i < hookHandlers.length; i++) {
1677
+ if (hookHandlers[i] === handler) {
1678
+ return i;
1679
+ }
1680
+ }
1681
+ return -1;
1682
+ }
1671
1683
  function useHooks(hookName, handler) {
1672
1684
  var __hooks = this.__hooks;
1673
1685
  if (!__hooks) {
@@ -1677,7 +1689,12 @@
1677
1689
  console.warn("has no supported hook which name [".concat(hookName, "]"));
1678
1690
  return false;
1679
1691
  }
1680
- __hooks && (__hooks[hookName] = handler);
1692
+ if (!Array.isArray(__hooks[hookName])) {
1693
+ __hooks[hookName] = [];
1694
+ }
1695
+ if (findHookIndex.call(this, hookName, handler) === -1) {
1696
+ __hooks[hookName].push(handler);
1697
+ }
1681
1698
  return true;
1682
1699
  }
1683
1700
  function removeHooks(hookName, handler) {
@@ -1685,6 +1702,13 @@
1685
1702
  if (!__hooks) {
1686
1703
  return;
1687
1704
  }
1705
+ if (Array.isArray(__hooks[hookName])) {
1706
+ var hooks = __hooks[hookName];
1707
+ var index = findHookIndex.call(this, hookName, handler);
1708
+ if (index !== -1) {
1709
+ hooks.splice(index, 1);
1710
+ }
1711
+ }
1688
1712
  delete __hooks[hookName];
1689
1713
  }
1690
1714
  function hooksDescriptor(instance) {
@@ -1706,6 +1730,38 @@
1706
1730
  function delHooksDescriptor(instance) {
1707
1731
  instance.__hooks = null;
1708
1732
  }
1733
+ function runHooks(obj, hookName, handler) {
1734
+ for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1735
+ args[_key5 - 3] = arguments[_key5];
1736
+ }
1737
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
1738
+ var hooks = obj.__hooks[hookName];
1739
+ var index = -1;
1740
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
1741
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1742
+ args2[_key6 - 3] = arguments[_key6];
1743
+ }
1744
+ index++;
1745
+ if (hooks.length === 0 || index === hooks.length) {
1746
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1747
+ }
1748
+ var hook2 = hooks[index];
1749
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1750
+ if (ret && ret.then) {
1751
+ return ret.then(function(data) {
1752
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1753
+ }).catch(function(e) {
1754
+ console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1755
+ });
1756
+ } else if (ret !== false) {
1757
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1758
+ }
1759
+ };
1760
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1761
+ } else {
1762
+ return handler.call.apply(handler, [obj, obj].concat(args));
1763
+ }
1764
+ }
1709
1765
  function showErrorMsg(pluginName, msg) {
1710
1766
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1711
1767
  }