@volcengine/veplayer-plugin 2.4.3-rc.0 → 2.4.5-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 (31) hide show
  1. package/esm/index.development.js +499 -1891
  2. package/esm/index.production.js +1 -1
  3. package/esm/veplayer.plugin.abr.development.js +3 -71
  4. package/esm/veplayer.plugin.abr.production.js +1 -1
  5. package/esm/veplayer.plugin.drm.development.js +3 -71
  6. package/esm/veplayer.plugin.drm.production.js +1 -1
  7. package/esm/veplayer.plugin.flv.development.js +196 -727
  8. package/esm/veplayer.plugin.flv.production.js +1 -1
  9. package/esm/veplayer.plugin.hls.development.js +304 -1233
  10. package/esm/veplayer.plugin.hls.production.js +1 -1
  11. package/esm/veplayer.plugin.mp4.development.js +5 -73
  12. package/esm/veplayer.plugin.mp4.production.js +1 -1
  13. package/esm/veplayer.plugin.rtm.development.js +4 -72
  14. package/esm/veplayer.plugin.rtm.production.js +1 -1
  15. package/esm/veplayer.plugin.shaka.development.js +4 -72
  16. package/esm/veplayer.plugin.shaka.production.js +1 -1
  17. package/package.json +1 -1
  18. package/umd/veplayer.plugin.abr.development.js +3 -71
  19. package/umd/veplayer.plugin.abr.production.js +1 -1
  20. package/umd/veplayer.plugin.drm.development.js +3 -71
  21. package/umd/veplayer.plugin.drm.production.js +1 -1
  22. package/umd/veplayer.plugin.flv.development.js +196 -727
  23. package/umd/veplayer.plugin.flv.production.js +1 -1
  24. package/umd/veplayer.plugin.hls.development.js +304 -1233
  25. package/umd/veplayer.plugin.hls.production.js +1 -1
  26. package/umd/veplayer.plugin.mp4.development.js +5 -73
  27. package/umd/veplayer.plugin.mp4.production.js +1 -1
  28. package/umd/veplayer.plugin.rtm.development.js +4 -72
  29. package/umd/veplayer.plugin.rtm.production.js +1 -1
  30. package/umd/veplayer.plugin.shaka.development.js +4 -72
  31. package/umd/veplayer.plugin.shaka.production.js +1 -1
@@ -896,7 +896,8 @@ function hook(hookName, handler) {
896
896
  }
897
897
  if (this.__hooks && this.__hooks[hookName]) {
898
898
  try {
899
- var preRet = runHooks(this, hookName, handler);
899
+ var _this$__hooks$hookNam;
900
+ var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
900
901
  if (preRet) {
901
902
  if (preRet.then) {
902
903
  preRet.then(function(isContinue) {
@@ -921,19 +922,6 @@ function hook(hookName, handler) {
921
922
  }
922
923
  }.bind(this);
923
924
  }
924
- function findHookIndex(hookName, handler) {
925
- var __hooks = this.__hooks;
926
- if (!__hooks || !Array.isArray(__hooks[hookName])) {
927
- return -1;
928
- }
929
- var hookHandlers = __hooks[hookName];
930
- for (var i = 0; i < hookHandlers.length; i++) {
931
- if (hookHandlers[i] === handler) {
932
- return i;
933
- }
934
- }
935
- return -1;
936
- }
937
925
  function useHooks(hookName, handler) {
938
926
  var __hooks = this.__hooks;
939
927
  if (!__hooks) {
@@ -943,12 +931,7 @@ function useHooks(hookName, handler) {
943
931
  console.warn("has no supported hook which name [".concat(hookName, "]"));
944
932
  return false;
945
933
  }
946
- if (!Array.isArray(__hooks[hookName])) {
947
- __hooks[hookName] = [];
948
- }
949
- if (findHookIndex.call(this, hookName, handler) === -1) {
950
- __hooks[hookName].push(handler);
951
- }
934
+ __hooks && (__hooks[hookName] = handler);
952
935
  return true;
953
936
  }
954
937
  function removeHooks(hookName, handler) {
@@ -956,13 +939,6 @@ function removeHooks(hookName, handler) {
956
939
  if (!__hooks) {
957
940
  return;
958
941
  }
959
- if (Array.isArray(__hooks[hookName])) {
960
- var hooks = __hooks[hookName];
961
- var index = findHookIndex.call(this, hookName, handler);
962
- if (index !== -1) {
963
- hooks.splice(index, 1);
964
- }
965
- }
966
942
  delete __hooks[hookName];
967
943
  }
968
944
  function hooksDescriptor(instance) {
@@ -984,38 +960,6 @@ function hooksDescriptor(instance) {
984
960
  function delHooksDescriptor(instance) {
985
961
  instance.__hooks = null;
986
962
  }
987
- function runHooks(obj, hookName, handler) {
988
- for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
989
- args[_key5 - 3] = arguments[_key5];
990
- }
991
- if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
992
- var hooks = obj.__hooks[hookName];
993
- var index = -1;
994
- var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
995
- for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
996
- args2[_key6 - 3] = arguments[_key6];
997
- }
998
- index++;
999
- if (hooks.length === 0 || index === hooks.length) {
1000
- return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1001
- }
1002
- var hook2 = hooks[index];
1003
- var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1004
- if (ret && ret.then) {
1005
- return ret.then(function(data) {
1006
- return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1007
- }).catch(function(e) {
1008
- console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1009
- });
1010
- } else if (ret !== false) {
1011
- return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1012
- }
1013
- };
1014
- return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1015
- } else {
1016
- return handler.call.apply(handler, [obj, obj].concat(args));
1017
- }
1018
- }
1019
963
  function showErrorMsg(pluginName, msg) {
1020
964
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1021
965
  }
@@ -1255,18 +1199,6 @@ var BasePlugin = /* @__PURE__ */ function() {
1255
1199
  }
1256
1200
  }
1257
1201
  }
1258
- }, {
1259
- key: "defineMethod",
1260
- value: function defineMethod(Obj, map) {
1261
- for (var key in map) {
1262
- if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
1263
- Object.defineProperty(Obj, key, {
1264
- configurable: true,
1265
- value: map[key]
1266
- });
1267
- }
1268
- }
1269
- }
1270
1202
  }, {
1271
1203
  key: "defaultConfig",
1272
1204
  get: function get() {