@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
@@ -1542,7 +1542,7 @@
1542
1542
  }
1543
1543
  return offsetTime;
1544
1544
  };
1545
- var version = "3.0.19-rc.0";
1545
+ var version = "3.0.20-alpha.4";
1546
1546
  var ERROR_MAP = {
1547
1547
  1: 5101,
1548
1548
  2: 5102,
@@ -1650,8 +1650,7 @@
1650
1650
  }
1651
1651
  if (this.__hooks && this.__hooks[hookName]) {
1652
1652
  try {
1653
- var _this$__hooks$hookNam;
1654
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
1653
+ var preRet = runHooks(this, hookName, handler);
1655
1654
  if (preRet) {
1656
1655
  if (preRet.then) {
1657
1656
  preRet.then(function(isContinue) {
@@ -1676,6 +1675,19 @@
1676
1675
  }
1677
1676
  }.bind(this);
1678
1677
  }
1678
+ function findHookIndex(hookName, handler) {
1679
+ var __hooks = this.__hooks;
1680
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
1681
+ return -1;
1682
+ }
1683
+ var hookHandlers = __hooks[hookName];
1684
+ for (var i = 0; i < hookHandlers.length; i++) {
1685
+ if (hookHandlers[i] === handler) {
1686
+ return i;
1687
+ }
1688
+ }
1689
+ return -1;
1690
+ }
1679
1691
  function useHooks(hookName, handler) {
1680
1692
  var __hooks = this.__hooks;
1681
1693
  if (!__hooks) {
@@ -1685,7 +1697,12 @@
1685
1697
  console.warn("has no supported hook which name [".concat(hookName, "]"));
1686
1698
  return false;
1687
1699
  }
1688
- __hooks && (__hooks[hookName] = handler);
1700
+ if (!Array.isArray(__hooks[hookName])) {
1701
+ __hooks[hookName] = [];
1702
+ }
1703
+ if (findHookIndex.call(this, hookName, handler) === -1) {
1704
+ __hooks[hookName].push(handler);
1705
+ }
1689
1706
  return true;
1690
1707
  }
1691
1708
  function removeHooks(hookName, handler) {
@@ -1693,6 +1710,13 @@
1693
1710
  if (!__hooks) {
1694
1711
  return;
1695
1712
  }
1713
+ if (Array.isArray(__hooks[hookName])) {
1714
+ var hooks = __hooks[hookName];
1715
+ var index = findHookIndex.call(this, hookName, handler);
1716
+ if (index !== -1) {
1717
+ hooks.splice(index, 1);
1718
+ }
1719
+ }
1696
1720
  delete __hooks[hookName];
1697
1721
  }
1698
1722
  function hooksDescriptor(instance) {
@@ -1714,6 +1738,38 @@
1714
1738
  function delHooksDescriptor(instance) {
1715
1739
  instance.__hooks = null;
1716
1740
  }
1741
+ function runHooks(obj, hookName, handler) {
1742
+ for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1743
+ args[_key5 - 3] = arguments[_key5];
1744
+ }
1745
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
1746
+ var hooks = obj.__hooks[hookName];
1747
+ var index = -1;
1748
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
1749
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1750
+ args2[_key6 - 3] = arguments[_key6];
1751
+ }
1752
+ index++;
1753
+ if (hooks.length === 0 || index === hooks.length) {
1754
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1755
+ }
1756
+ var hook2 = hooks[index];
1757
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1758
+ if (ret && ret.then) {
1759
+ return ret.then(function(data) {
1760
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1761
+ }).catch(function(e) {
1762
+ console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1763
+ });
1764
+ } else if (ret !== false) {
1765
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1766
+ }
1767
+ };
1768
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1769
+ } else {
1770
+ return handler.call.apply(handler, [obj, obj].concat(args));
1771
+ }
1772
+ }
1717
1773
  function showErrorMsg(pluginName, msg) {
1718
1774
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1719
1775
  }