@volcengine/veplayer-plugin 2.4.5-rc.0 → 2.6.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 +11 -0
  3. package/esm/index.development.js +45800 -32626
  4. package/esm/index.production.css +1 -1
  5. package/esm/index.production.js +13 -4
  6. package/esm/veplayer.plugin.abr.development.js +71 -3
  7. package/esm/veplayer.plugin.abr.production.js +1 -1
  8. package/esm/veplayer.plugin.ad.development.css +11 -0
  9. package/esm/veplayer.plugin.ad.development.js +13194 -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 +71 -3
  13. package/esm/veplayer.plugin.drm.production.js +1 -1
  14. package/esm/veplayer.plugin.flv.development.js +729 -196
  15. package/esm/veplayer.plugin.flv.production.js +1 -1
  16. package/esm/veplayer.plugin.hls.development.js +1509 -376
  17. package/esm/veplayer.plugin.hls.production.js +1 -1
  18. package/esm/veplayer.plugin.mp4.development.js +73 -5
  19. package/esm/veplayer.plugin.mp4.production.js +1 -1
  20. package/esm/veplayer.plugin.rtm.development.js +72 -4
  21. package/esm/veplayer.plugin.rtm.production.js +1 -1
  22. package/esm/veplayer.plugin.shaka.development.js +72 -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 +71 -3
  27. package/umd/veplayer.plugin.abr.production.js +1 -1
  28. package/umd/veplayer.plugin.ad.development.css +11 -0
  29. package/umd/veplayer.plugin.ad.development.js +13197 -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 +71 -3
  33. package/umd/veplayer.plugin.drm.production.js +1 -1
  34. package/umd/veplayer.plugin.flv.development.js +729 -196
  35. package/umd/veplayer.plugin.flv.production.js +1 -1
  36. package/umd/veplayer.plugin.hls.development.js +1476 -343
  37. package/umd/veplayer.plugin.hls.production.js +1 -1
  38. package/umd/veplayer.plugin.mp4.development.js +73 -5
  39. package/umd/veplayer.plugin.mp4.production.js +1 -1
  40. package/umd/veplayer.plugin.rtm.development.js +72 -4
  41. package/umd/veplayer.plugin.rtm.production.js +1 -1
  42. package/umd/veplayer.plugin.shaka.development.js +72 -4
  43. package/umd/veplayer.plugin.shaka.production.js +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcengine/veplayer-plugin",
3
- "version": "2.4.5-rc.0",
3
+ "version": "2.6.0-rc.0",
4
4
  "main": "./umd/index.production.js",
5
5
  "module": "./esm/index.production.js",
6
6
  "browser": "./umd/index.production.js",
package/umd/index.d.ts CHANGED
@@ -5,5 +5,6 @@ export const rtm: any;
5
5
  export const shaka: any;
6
6
  export const xgvideo: any;
7
7
  export const timeShift: any;
8
+ export const ad: any;
8
9
  export const drm: any;
9
10
  export const abr: any;
@@ -1020,8 +1020,7 @@
1020
1020
  }
1021
1021
  if (this.__hooks && this.__hooks[hookName]) {
1022
1022
  try {
1023
- var _this$__hooks$hookNam;
1024
- var preRet = (_this$__hooks$hookNam = this.__hooks[hookName]).call.apply(_this$__hooks$hookNam, [this, this].concat(Array.prototype.slice.call(arguments)));
1023
+ var preRet = runHooks(this, hookName, handler);
1025
1024
  if (preRet) {
1026
1025
  if (preRet.then) {
1027
1026
  preRet.then(function(isContinue) {
@@ -1046,6 +1045,19 @@
1046
1045
  }
1047
1046
  }.bind(this);
1048
1047
  }
1048
+ function findHookIndex(hookName, handler) {
1049
+ var __hooks = this.__hooks;
1050
+ if (!__hooks || !Array.isArray(__hooks[hookName])) {
1051
+ return -1;
1052
+ }
1053
+ var hookHandlers = __hooks[hookName];
1054
+ for (var i = 0; i < hookHandlers.length; i++) {
1055
+ if (hookHandlers[i] === handler) {
1056
+ return i;
1057
+ }
1058
+ }
1059
+ return -1;
1060
+ }
1049
1061
  function useHooks(hookName, handler) {
1050
1062
  var __hooks = this.__hooks;
1051
1063
  if (!__hooks) {
@@ -1055,7 +1067,12 @@
1055
1067
  console.warn("has no supported hook which name [".concat(hookName, "]"));
1056
1068
  return false;
1057
1069
  }
1058
- __hooks && (__hooks[hookName] = handler);
1070
+ if (!Array.isArray(__hooks[hookName])) {
1071
+ __hooks[hookName] = [];
1072
+ }
1073
+ if (findHookIndex.call(this, hookName, handler) === -1) {
1074
+ __hooks[hookName].push(handler);
1075
+ }
1059
1076
  return true;
1060
1077
  }
1061
1078
  function removeHooks(hookName, handler) {
@@ -1063,6 +1080,13 @@
1063
1080
  if (!__hooks) {
1064
1081
  return;
1065
1082
  }
1083
+ if (Array.isArray(__hooks[hookName])) {
1084
+ var hooks = __hooks[hookName];
1085
+ var index = findHookIndex.call(this, hookName, handler);
1086
+ if (index !== -1) {
1087
+ hooks.splice(index, 1);
1088
+ }
1089
+ }
1066
1090
  delete __hooks[hookName];
1067
1091
  }
1068
1092
  function hooksDescriptor(instance) {
@@ -1084,6 +1108,38 @@
1084
1108
  function delHooksDescriptor(instance) {
1085
1109
  instance.__hooks = null;
1086
1110
  }
1111
+ function runHooks(obj, hookName, handler) {
1112
+ for (var _len5 = arguments.length, args = new Array(_len5 > 3 ? _len5 - 3 : 0), _key5 = 3; _key5 < _len5; _key5++) {
1113
+ args[_key5 - 3] = arguments[_key5];
1114
+ }
1115
+ if (obj.__hooks && Array.isArray(obj.__hooks[hookName])) {
1116
+ var hooks = obj.__hooks[hookName];
1117
+ var index = -1;
1118
+ var runHooksRecursive = function runHooksRecursive2(obj2, hookName2, handler2) {
1119
+ for (var _len6 = arguments.length, args2 = new Array(_len6 > 3 ? _len6 - 3 : 0), _key6 = 3; _key6 < _len6; _key6++) {
1120
+ args2[_key6 - 3] = arguments[_key6];
1121
+ }
1122
+ index++;
1123
+ if (hooks.length === 0 || index === hooks.length) {
1124
+ return handler2.call.apply(handler2, [obj2, obj2].concat(args2));
1125
+ }
1126
+ var hook2 = hooks[index];
1127
+ var ret = hook2.call.apply(hook2, [obj2, obj2].concat(args2));
1128
+ if (ret && ret.then) {
1129
+ return ret.then(function(data) {
1130
+ return data === false ? null : runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1131
+ }).catch(function(e) {
1132
+ console.warn("[runHooks]".concat(hookName2, " reject"), e.message);
1133
+ });
1134
+ } else if (ret !== false) {
1135
+ return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
1136
+ }
1137
+ };
1138
+ return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
1139
+ } else {
1140
+ return handler.call.apply(handler, [obj, obj].concat(args));
1141
+ }
1142
+ }
1087
1143
  function showErrorMsg(pluginName, msg) {
1088
1144
  XG_DEBUG.logError("[".concat(pluginName, "] event or callback cant be undefined or null when call ").concat(msg));
1089
1145
  }
@@ -1323,6 +1379,18 @@
1323
1379
  }
1324
1380
  }
1325
1381
  }
1382
+ }, {
1383
+ key: "defineMethod",
1384
+ value: function defineMethod(Obj, map) {
1385
+ for (var key in map) {
1386
+ if (Object.prototype.hasOwnProperty.call(map, key) && typeof map[key] === "function") {
1387
+ Object.defineProperty(Obj, key, {
1388
+ configurable: true,
1389
+ value: map[key]
1390
+ });
1391
+ }
1392
+ }
1393
+ }
1326
1394
  }, {
1327
1395
  key: "defaultConfig",
1328
1396
  get: function get() {