xgplayer 3.1.0-alpha.0 → 3.1.0-alpha.2

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 (98) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/dist/index.min.css +1 -1
  3. package/dist/index.min.js +1 -1
  4. package/dist/index.min.js.map +1 -1
  5. package/es/constant.d.ts +0 -4
  6. package/es/constant.js +4 -1
  7. package/es/defaultConfig.js +2 -0
  8. package/es/error.js +2 -2
  9. package/es/index.d.ts +2 -1
  10. package/es/index.js +4 -3
  11. package/es/index.umd.d.ts +60 -1
  12. package/es/index.umd.js +29 -1
  13. package/es/lang/i18n.js +4 -4
  14. package/es/mediaProxy.d.ts +8 -0
  15. package/es/mediaProxy.js +13 -8
  16. package/es/player.d.ts +119 -14
  17. package/es/player.js +669 -163
  18. package/es/plugin/basePlugin.d.ts +6 -3
  19. package/es/plugin/basePlugin.js +6 -5
  20. package/es/plugin/index.d.ts +2 -1
  21. package/es/plugin/plugin.d.ts +0 -1
  22. package/es/plugin/plugin.js +11 -11
  23. package/es/plugin/pluginsManager.d.ts +14 -0
  24. package/es/plugin/pluginsManager.js +32 -16
  25. package/es/plugin/resizeObserver.js +1 -1
  26. package/es/plugins/common/iconPlugin.js +1 -0
  27. package/es/plugins/common/optionList.js +10 -10
  28. package/es/plugins/common/optionsIcon.js +13 -9
  29. package/es/plugins/common/thumbnail.d.ts +0 -1
  30. package/es/plugins/common/thumbnail.js +3 -24
  31. package/es/plugins/controls/index.css +132 -0
  32. package/es/plugins/controls/index.js +189 -0
  33. package/es/plugins/cssFullScreen/index.js +2 -1
  34. package/es/plugins/danmu/danmuIcon.js +1 -0
  35. package/es/plugins/danmu/danmuPanel.js +2 -2
  36. package/es/plugins/danmu/index.js +4 -4
  37. package/es/plugins/definition/index.js +2 -2
  38. package/es/plugins/download/index.js +3 -3
  39. package/es/plugins/dynamicBg/index.js +5 -5
  40. package/es/plugins/enter/index.js +2 -2
  41. package/es/plugins/error/index.js +2 -1
  42. package/es/plugins/fpsDetect/index.js +2 -1
  43. package/es/plugins/fullscreen/backicon.js +3 -3
  44. package/es/plugins/fullscreen/index.js +2 -2
  45. package/es/plugins/gapJump/index.js +2 -1
  46. package/es/plugins/heatmap/index.css +25 -0
  47. package/es/plugins/heatmap/index.d.ts +70 -0
  48. package/es/plugins/heatmap/index.js +306 -0
  49. package/es/plugins/heatmap/index.scss +28 -0
  50. package/es/plugins/keyboard/index.js +3 -3
  51. package/es/plugins/logger/index.js +11 -11
  52. package/es/plugins/miniScreen/index.js +6 -6
  53. package/es/plugins/miniScreen/miniScreenIcon.js +1 -0
  54. package/es/plugins/mobile/index.js +14 -14
  55. package/es/plugins/pc/index.js +3 -3
  56. package/es/plugins/pip/index.d.ts +11 -1
  57. package/es/plugins/pip/index.js +112 -13
  58. package/es/plugins/play/index.js +2 -1
  59. package/es/plugins/playNext/index.js +2 -1
  60. package/es/plugins/playbackRate/index.js +2 -1
  61. package/es/plugins/poster/index.css +4 -0
  62. package/es/plugins/poster/index.js +12 -10
  63. package/es/plugins/poster/index.scss +4 -0
  64. package/es/plugins/progress/index.js +35 -33
  65. package/es/plugins/progress/innerList.js +11 -9
  66. package/es/plugins/progress/miniProgress.js +1 -0
  67. package/es/plugins/progressPreview/dotsApi.js +5 -5
  68. package/es/plugins/progressPreview/index.d.ts +2 -2
  69. package/es/plugins/progressPreview/index.js +29 -29
  70. package/es/plugins/prompt/index.js +5 -5
  71. package/es/plugins/replay/index.js +3 -3
  72. package/es/plugins/rotate/index.js +2 -2
  73. package/es/plugins/screenShot/index.d.ts +1 -0
  74. package/es/plugins/screenShot/index.js +8 -3
  75. package/es/plugins/start/index.js +13 -13
  76. package/es/plugins/stats/index.js +1 -1
  77. package/es/plugins/testspeed/index.js +2 -2
  78. package/es/plugins/time/index.js +34 -31
  79. package/es/plugins/time/timesegments.js +7 -7
  80. package/es/plugins/track/index.js +6 -6
  81. package/es/plugins/volume/index.js +15 -15
  82. package/es/plugins/waitingTimeoutJump/index.js +2 -1
  83. package/es/presets/default-en.d.ts +2 -1
  84. package/es/presets/default-en.js +6 -4
  85. package/es/presets/default.d.ts +3 -2
  86. package/es/presets/default.js +6 -4
  87. package/es/stateClassMap.d.ts +1 -0
  88. package/es/stateClassMap.js +1 -0
  89. package/es/utils/database.js +107 -0
  90. package/es/utils/util.d.ts +300 -282
  91. package/es/utils/util.js +352 -145
  92. package/es/utils/xgplayerTimeRange.d.ts +7 -0
  93. package/es/utils/xgplayerTimeRange.js +25 -0
  94. package/es/version.js +1 -1
  95. package/package.json +3 -10
  96. package/es/simple.umd.d.ts +0 -2
  97. package/es/utils/throttle.d.ts +0 -12
  98. package/es/utils/throttle.js +0 -132
@@ -93,8 +93,10 @@ declare class BasePlugin {
93
93
  * @type { string }
94
94
  */
95
95
  get lang(): string;
96
- get i18n(): any;
97
- get i18nKeys(): any;
96
+ get i18n(): import("../lang/i18n").IXGI18nText;
97
+ get i18nKeys(): {
98
+ [propName: string]: string;
99
+ };
98
100
  /**
99
101
  * @description当前支持的事件类型
100
102
  * @type { 'touch' | 'mouse' }
@@ -170,8 +172,9 @@ declare class BasePlugin {
170
172
  getPlugin(name: string): any | null;
171
173
  __destroy(): void;
172
174
  }
175
+ import Util from "../utils/util";
173
176
  import Sniffer from "../utils/sniffer";
174
177
  import Errors from "../error";
175
178
  import * as Events from "../events";
176
179
  import XG_DEBUG from "../utils/debug";
177
- export { BasePlugin as default, Sniffer, Errors, Events, XG_DEBUG };
180
+ export { BasePlugin as default, Util, Sniffer, Errors, Events, XG_DEBUG };
@@ -1,5 +1,6 @@
1
1
  import { createClass as _createClass, classCallCheck as _classCallCheck, objectSpread2 as _objectSpread2 } from "../_virtual/_rollupPluginBabelHelpers.js";
2
- import { checkIsFunction, clearAllTimers, checkTouchSupport } from "../utils/util.js";
2
+ import util from "../utils/util.js";
3
+ export { default as Util } from "../utils/util.js";
3
4
  import XG_DEBUG from "../utils/debug.js";
4
5
  export { default as XG_DEBUG } from "../utils/debug.js";
5
6
  import hooksDescriptor, { hook, useHooks, removeHooks, delHooksDescriptor } from "./hooksDescriptor.js";
@@ -9,7 +10,7 @@ function showErrorMsg(pluginName, msg) {
9
10
  var BasePlugin = /* @__PURE__ */ function() {
10
11
  function BasePlugin2(args) {
11
12
  _classCallCheck(this, BasePlugin2);
12
- if (checkIsFunction(this.beforeCreate)) {
13
+ if (util.checkIsFunction(this.beforeCreate)) {
13
14
  this.beforeCreate(args);
14
15
  }
15
16
  hooksDescriptor(this);
@@ -79,7 +80,7 @@ var BasePlugin = /* @__PURE__ */ function() {
79
80
  }, {
80
81
  key: "domEventType",
81
82
  get: function get() {
82
- var _e = checkTouchSupport() ? "touch" : "mouse";
83
+ var _e = util.checkTouchSupport() ? "touch" : "mouse";
83
84
  if (this.playerConfig && (this.playerConfig.domEventType === "touch" || this.playerConfig.domEventType === "mouse")) {
84
85
  _e = this.playerConfig.domEventType;
85
86
  }
@@ -223,8 +224,8 @@ var BasePlugin = /* @__PURE__ */ function() {
223
224
  var player = this.player;
224
225
  var pluginName = this.pluginName;
225
226
  this.offAll();
226
- clearAllTimers(this);
227
- if (checkIsFunction(this.destroy)) {
227
+ util.clearAllTimers(this);
228
+ if (util.checkIsFunction(this.destroy)) {
228
229
  this.destroy();
229
230
  }
230
231
  ["player", "playerConfig", "pluginName", "logger", "__args", "__hooks"].map(function(item) {
@@ -6,7 +6,8 @@ import { POSITIONS } from "./plugin";
6
6
  import { ROOT_TYPES } from "./plugin";
7
7
  import Sniffer from "../utils/sniffer";
8
8
  import Errors from "../error";
9
+ import Util from "../utils/util";
9
10
  import * as Events from "../events";
10
11
  import { STATES } from "../state";
11
12
  import Plugin from "./plugin";
12
- export { pluginsManager, BasePlugin, hooksDescriptor, STATE_CLASS, POSITIONS, ROOT_TYPES, Sniffer, Errors, Events, STATES, Plugin as default };
13
+ export { pluginsManager, BasePlugin, hooksDescriptor, STATE_CLASS, POSITIONS, ROOT_TYPES, Sniffer, Errors, Util, Events, STATES, Plugin as default };
@@ -100,7 +100,6 @@ declare class Plugin extends BasePlugin {
100
100
  */
101
101
  private _children;
102
102
  updateLang(lang: any): void;
103
- get lang(): any;
104
103
  changeLangTextKey(dom: any, key?: string): void;
105
104
  plugins(): any[];
106
105
  children(): {};
@@ -1,8 +1,8 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, createClass as _createClass, classCallCheck as _classCallCheck, get as _get, getPrototypeOf as _getPrototypeOf, typeof as _typeof } from "../_virtual/_rollupPluginBabelHelpers.js";
2
2
  import BasePlugin from "./basePlugin.js";
3
- import { createDom, deepCopy, typeOf, addClass, createDomFromHtml } from "../utils/util.js";
4
3
  import _delegate from "delegate";
5
4
  import XG_DEBUG from "../utils/debug.js";
5
+ import util from "../utils/util.js";
6
6
  var ROOT_TYPES = {
7
7
  CONTROLS: "controls",
8
8
  ROOT: "root"
@@ -44,7 +44,7 @@ function createIcon(icon, key) {
44
44
  var pluginName = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : "";
45
45
  var newIcon = null;
46
46
  if (icon instanceof window.Element) {
47
- addClass(icon, classname);
47
+ util.addClass(icon, classname);
48
48
  Object.keys(attr).map(function(key2) {
49
49
  icon.setAttribute(key2, attr[key2]);
50
50
  });
@@ -52,14 +52,14 @@ function createIcon(icon, key) {
52
52
  }
53
53
  if (isUrl(icon) || isUrl(icon.url)) {
54
54
  attr.src = isUrl(icon) ? icon : icon.url || "";
55
- newIcon = createDom(icon.tag || "img", "", attr, "xg-img ".concat(classname));
55
+ newIcon = util.createDom(icon.tag || "img", "", attr, "xg-img ".concat(classname));
56
56
  return newIcon;
57
57
  }
58
58
  if (typeof icon === "function") {
59
59
  try {
60
60
  newIcon = icon();
61
61
  if (newIcon instanceof window.Element) {
62
- addClass(newIcon, classname);
62
+ util.addClass(newIcon, classname);
63
63
  Object.keys(attr).map(function(key2) {
64
64
  newIcon.setAttribute(key2, attr[key2]);
65
65
  });
@@ -74,7 +74,7 @@ function createIcon(icon, key) {
74
74
  }
75
75
  }
76
76
  if (typeof icon === "string") {
77
- return createDomFromHtml(icon, attr, classname);
77
+ return util.createDomFromHtml(icon, attr, classname);
78
78
  }
79
79
  XG_DEBUG.logWarn("warn>>icons.".concat(key, " in config of plugin named [").concat(pluginName, "] is invalid"));
80
80
  return null;
@@ -150,7 +150,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
150
150
  _el = Plugin2.insert(renderStr, _parent, args.index);
151
151
  _el.setAttribute("data-index", args.index);
152
152
  } else if (args.tag) {
153
- _el = createDom(args.tag, "", args.attr, args.name);
153
+ _el = util.createDom(args.tag, "", args.attr, args.name);
154
154
  _el.setAttribute("data-index", args.index);
155
155
  _parent.appendChild(_el);
156
156
  } else {
@@ -189,7 +189,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
189
189
  config = _this2.config[name] || {};
190
190
  _Plugin = _plugin;
191
191
  } else if (_typeof(_plugin) === "object" && typeof _plugin.plugin === "function") {
192
- config = _plugin.options ? deepCopy(_this2.config[name] || {}, _plugin.options) : _this2.config[name] || {};
192
+ config = _plugin.options ? util.deepCopy(_this2.config[name] || {}, _plugin.options) : _this2.config[name] || {};
193
193
  _Plugin = _plugin.plugin;
194
194
  }
195
195
  options.config = config;
@@ -331,9 +331,9 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
331
331
  if (!this.root) {
332
332
  return;
333
333
  }
334
- if (typeOf(name) === "String") {
334
+ if (util.typeOf(name) === "String") {
335
335
  return this.root.style[name] = value;
336
- } else if (typeOf(name) === "Object") {
336
+ } else if (util.typeOf(name) === "Object") {
337
337
  Object.keys(name).map(function(key) {
338
338
  _this5.root.style[key] = name[key];
339
339
  });
@@ -346,9 +346,9 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
346
346
  if (!this.root) {
347
347
  return;
348
348
  }
349
- if (typeOf(name) === "String") {
349
+ if (util.typeOf(name) === "String") {
350
350
  return this.root.setAttribute(name, value);
351
- } else if (typeOf(name) === "Object") {
351
+ } else if (util.typeOf(name) === "Object") {
352
352
  Object.keys(name).map(function(key) {
353
353
  _this6.root.setAttribute(key, name[key]);
354
354
  });
@@ -57,6 +57,20 @@ declare namespace pluginsManager {
57
57
  }): {
58
58
  [propName: string]: any;
59
59
  };
60
+ /**
61
+ * register a lazy plugin
62
+ * @param { any } player instance
63
+ * @param { any } lazyPlugin config
64
+ *
65
+ */
66
+ function lazyRegister(player: any, lazyPlugin: any): Promise<any>;
67
+ /**
68
+ * register a lazy plugin
69
+ * @param { any } player instance
70
+ * @param { any } lazyPlugin config
71
+ *
72
+ */
73
+ function lazyRegister(player: any, lazyPlugin: any): Promise<any>;
60
74
  /**
61
75
  * register a Plugin
62
76
  * @param { any } player the plugins register
@@ -1,5 +1,5 @@
1
1
  import { addObserver, unObserver } from "./resizeObserver.js";
2
- import { typeOf } from "../utils/util.js";
2
+ import util from "../utils/util.js";
3
3
  var pluginsManager = {
4
4
  pluginGroup: {},
5
5
  init: function init(player) {
@@ -68,7 +68,7 @@ var pluginsManager = {
68
68
  break;
69
69
  }
70
70
  }
71
- if (typeOf(_pConfig) === "Object") {
71
+ if (util.typeOf(_pConfig) === "Object") {
72
72
  return {
73
73
  root: _pConfig.root,
74
74
  position: _pConfig.position
@@ -76,6 +76,23 @@ var pluginsManager = {
76
76
  }
77
77
  return {};
78
78
  },
79
+ lazyRegister: function lazyRegister(player, lazyPlugin) {
80
+ var _this = this;
81
+ var timeout = lazyPlugin.timeout || 1500;
82
+ return Promise.race([lazyPlugin.loader().then(function(plugin) {
83
+ var result;
84
+ if (plugin && plugin.__esModule) {
85
+ result = plugin.default;
86
+ } else {
87
+ result = plugin;
88
+ }
89
+ _this.register(player, result, plugin.options);
90
+ }), new Promise(function(resolve, reject) {
91
+ setTimeout(function() {
92
+ reject(new Error("timeout"));
93
+ }, timeout);
94
+ })]);
95
+ },
79
96
  register: function register(player, plugin) {
80
97
  var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
81
98
  if (!player || !plugin || typeof plugin !== "function" || plugin.prototype === void 0) {
@@ -106,9 +123,9 @@ var pluginsManager = {
106
123
  for (var i = 0; i < keys.length; i++) {
107
124
  if (pluginName.toLowerCase() === keys[i].toLowerCase()) {
108
125
  var config = originalOptions[keys[i]];
109
- if (typeOf(config) === "Object") {
126
+ if (util.typeOf(config) === "Object") {
110
127
  options.config = Object.assign({}, options.config, originalOptions[keys[i]]);
111
- } else if (typeOf(config) === "Boolean") {
128
+ } else if (util.typeOf(config) === "Boolean") {
112
129
  options.config.disable = !config;
113
130
  }
114
131
  break;
@@ -128,14 +145,13 @@ var pluginsManager = {
128
145
  }
129
146
  options.index = options.config.index || 0;
130
147
  try {
131
- var pluginNameL = pluginName.toLowerCase();
132
- if (plugins[pluginNameL]) {
133
- this.unRegister(cgid, pluginNameL);
148
+ if (plugins[pluginName.toLowerCase()]) {
149
+ this.unRegister(cgid, pluginName.toLowerCase());
134
150
  console.warn("the is one plugin with same pluginName [".concat(pluginName, "] exist, destroy the old instance"));
135
151
  }
136
152
  var _instance = new plugin(options);
137
- plugins[pluginNameL] = _instance;
138
- plugins[pluginNameL].func = plugin;
153
+ plugins[pluginName.toLowerCase()] = _instance;
154
+ plugins[pluginName.toLowerCase()].func = plugin;
139
155
  if (_instance && typeof _instance.afterCreate === "function") {
140
156
  _instance.afterCreate();
141
157
  }
@@ -179,7 +195,7 @@ var pluginsManager = {
179
195
  return this.pluginGroup[cgid]._plugins[cName];
180
196
  },
181
197
  beforeInit: function beforeInit(player) {
182
- var _this = this;
198
+ var _this2 = this;
183
199
  function retPromise(fun) {
184
200
  if (!fun || !fun.then) {
185
201
  return new Promise(function(resolve) {
@@ -190,7 +206,7 @@ var pluginsManager = {
190
206
  }
191
207
  }
192
208
  return new Promise(function(resolve) {
193
- if (!_this.pluginGroup) {
209
+ if (!_this2.pluginGroup) {
194
210
  return;
195
211
  }
196
212
  var prevTask;
@@ -201,11 +217,11 @@ var pluginsManager = {
201
217
  }
202
218
  return prevTask.then(function() {
203
219
  var cgid = player._pluginInfoId;
204
- if (!_this.pluginGroup[cgid]) {
220
+ if (!_this2.pluginGroup[cgid]) {
205
221
  resolve();
206
222
  return;
207
223
  }
208
- var plugins = _this.pluginGroup[cgid]._plugins;
224
+ var plugins = _this2.pluginGroup[cgid]._plugins;
209
225
  var pluginsRet = [];
210
226
  Object.keys(plugins).forEach(function(pName) {
211
227
  if (plugins[pName] && plugins[pName].beforePlayerInit) {
@@ -258,7 +274,7 @@ var pluginsManager = {
258
274
  });
259
275
  },
260
276
  reRender: function reRender(player) {
261
- var _this2 = this;
277
+ var _this3 = this;
262
278
  var cgid = player._pluginInfoId;
263
279
  if (!cgid || !this.pluginGroup[cgid]) {
264
280
  return;
@@ -271,11 +287,11 @@ var pluginsManager = {
271
287
  plugin: plugins[pName].func,
272
288
  options: plugins[pName].__args
273
289
  });
274
- _this2.unRegister(cgid, pName);
290
+ _this3.unRegister(cgid, pName);
275
291
  }
276
292
  });
277
293
  _pList.forEach(function(item) {
278
- _this2.register(player, item.plugin, item.options);
294
+ _this3.register(player, item.plugin, item.options);
279
295
  });
280
296
  },
281
297
  onPluginsReady: function onPluginsReady(player) {
@@ -1,5 +1,5 @@
1
1
  import { createClass as _createClass, classCallCheck as _classCallCheck, defineProperty as _defineProperty } from "../_virtual/_rollupPluginBabelHelpers.js";
2
- import { throttle } from "../utils/throttle.js";
2
+ import { throttle } from "../utils/util.js";
3
3
  import { PLATER_ID } from "../constant.js";
4
4
  var ResizeObserver = /* @__PURE__ */ function() {
5
5
  function ResizeObserver2() {
@@ -1,4 +1,5 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import "../../utils/util.js";
2
3
  import "../../utils/debug.js";
3
4
  import Plugin from "../../plugin/plugin.js";
4
5
  var Icon = /* @__PURE__ */ function(_Plugin) {
@@ -1,6 +1,6 @@
1
1
  import { createClass as _createClass, classCallCheck as _classCallCheck } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
2
3
  import sniffer from "../../utils/sniffer.js";
3
- import { createDom, hasClass, addClass, removeClass } from "../../utils/util.js";
4
4
  import "../../utils/debug.js";
5
5
  import Plugin from "../../plugin/plugin.js";
6
6
  var OptionList = /* @__PURE__ */ function() {
@@ -8,7 +8,7 @@ var OptionList = /* @__PURE__ */ function() {
8
8
  _classCallCheck(this, OptionList2);
9
9
  this.config = args.config;
10
10
  this.parent = args.root;
11
- this.root = createDom("ul", "", {}, "xg-options-list xg-list-slide-scroll ".concat(this.config.className));
11
+ this.root = util.createDom("ul", "", {}, "xg-options-list xg-list-slide-scroll ".concat(this.config.className));
12
12
  args.root.appendChild(this.root);
13
13
  var maxHeight = this.config.maxHeight;
14
14
  if (maxHeight) {
@@ -43,7 +43,7 @@ var OptionList = /* @__PURE__ */ function() {
43
43
  data.map(function(item, index) {
44
44
  var className = item.selected ? "option-item selected" : "option-item";
45
45
  item["data-index"] = index;
46
- _this.root.appendChild(createDom("li", "<span>".concat(item.showText, "</span>"), item, className));
46
+ _this.root.appendChild(util.createDom("li", "<span>".concat(item.showText, "</span>"), item, className));
47
47
  });
48
48
  }
49
49
  }, {
@@ -53,13 +53,13 @@ var OptionList = /* @__PURE__ */ function() {
53
53
  e.delegateTarget = e.target;
54
54
  }
55
55
  var target = e.delegateTarget;
56
- if (target && hasClass(target, "selected")) {
56
+ if (target && util.hasClass(target, "selected")) {
57
57
  return false;
58
58
  }
59
59
  var changeCallback = typeof this.config.onItemClick === "function" ? this.config.onItemClick : null;
60
60
  var curSelected = this.root.querySelector(".selected");
61
- addClass(target, "selected");
62
- curSelected && removeClass(curSelected, "selected");
61
+ util.addClass(target, "selected");
62
+ curSelected && util.removeClass(curSelected, "selected");
63
63
  changeCallback(e, {
64
64
  from: curSelected ? this.getAttrObj(curSelected, this.attrKeys) : null,
65
65
  to: this.getAttrObj(target, this.attrKeys)
@@ -84,14 +84,14 @@ var OptionList = /* @__PURE__ */ function() {
84
84
  }, {
85
85
  key: "show",
86
86
  value: function show() {
87
- removeClass(this.root, "hide");
88
- addClass(this.root, "active");
87
+ util.removeClass(this.root, "hide");
88
+ util.addClass(this.root, "active");
89
89
  }
90
90
  }, {
91
91
  key: "hide",
92
92
  value: function hide() {
93
- removeClass(this.root, "active");
94
- addClass(this.root, "hide");
93
+ util.removeClass(this.root, "active");
94
+ util.addClass(this.root, "hide");
95
95
  }
96
96
  }, {
97
97
  key: "setStyle",
@@ -1,6 +1,6 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, typeof as _typeof } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
2
3
  import sniffer from "../../utils/sniffer.js";
3
- import { addClass, createDom, removeClass, isUndefined } from "../../utils/util.js";
4
4
  import { VIDEO_RESIZE, FULLSCREEN_CHANGE, CANPLAY, PLAYER_FOCUS } from "../../events.js";
5
5
  import "../../utils/debug.js";
6
6
  import Plugin, { POSITIONS } from "../../plugin/plugin.js";
@@ -80,7 +80,7 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
80
80
  if (IS_MOBILE && config.listType !== LIST_TYPES.MIDDLE) {
81
81
  config.listType = LIST_TYPES.SIDE;
82
82
  }
83
- config.hidePortrait && addClass(this.root, "portrait");
83
+ config.hidePortrait && util.addClass(this.root, "portrait");
84
84
  this.on([VIDEO_RESIZE, FULLSCREEN_CHANGE], function() {
85
85
  _this2._resizeList();
86
86
  });
@@ -128,8 +128,8 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
128
128
  if (_isIcons) {
129
129
  return;
130
130
  }
131
- this.appendChild(".xgplayer-icon", createDom("span", "", {}, "icon-text"));
132
- addClass(this.find(".xgplayer-icon"), "btn-text");
131
+ this.appendChild(".xgplayer-icon", util.createDom("span", "", {}, "icon-text"));
132
+ util.addClass(this.find(".xgplayer-icon"), "btn-text");
133
133
  }
134
134
  }, {
135
135
  key: "show",
@@ -137,12 +137,12 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
137
137
  if (!this.config.list || this.config.list.length < 2) {
138
138
  return;
139
139
  }
140
- addClass(this.root, "show");
140
+ util.addClass(this.root, "show");
141
141
  }
142
142
  }, {
143
143
  key: "hide",
144
144
  value: function hide() {
145
- removeClass(this.root, "show");
145
+ util.removeClass(this.root, "show");
146
146
  }
147
147
  }, {
148
148
  key: "getTextByLang",
@@ -152,7 +152,7 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
152
152
  }
153
153
  var list = this.config.list;
154
154
  !lang && (lang = this.player.lang);
155
- key = !key || isUndefined(item[key]) ? "text" : key;
155
+ key = !key || util.isUndefined(item[key]) ? "text" : key;
156
156
  typeof item === "number" && (item = list[item]);
157
157
  try {
158
158
  if (_typeof(item[key]) === "object") {
@@ -236,7 +236,7 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
236
236
  if (this.config.isShowIcon) {
237
237
  var _this$player$root$get = this.player.root.getBoundingClientRect(), height = _this$player$root$get.height;
238
238
  var _maxH = config.listType === LIST_TYPES.MIDDLE ? height - 50 : height;
239
- if (_maxH) {
239
+ if (_maxH && config.heightLimit) {
240
240
  options.config.maxHeight = "".concat(_maxH, "px");
241
241
  }
242
242
  this.optionsList = new OptionList(options);
@@ -248,6 +248,9 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
248
248
  }, {
249
249
  key: "_resizeList",
250
250
  value: function _resizeList() {
251
+ if (!this.config.heightLimit) {
252
+ return;
253
+ }
251
254
  var _this$player$root$get2 = this.player.root.getBoundingClientRect(), height = _this$player$root$get2.height;
252
255
  var _maxH = this.config.listType === LIST_TYPES.MIDDLE ? height - 50 : height;
253
256
  this.optionsList && this.optionsList.setStyle({
@@ -295,7 +298,8 @@ var OptionsIcon = /* @__PURE__ */ function(_Plugin) {
295
298
  hidePortrait: true,
296
299
  isShowIcon: false,
297
300
  isItemClickHide: true,
298
- toggleMode: TOGGLE_MODES.HOVER
301
+ toggleMode: TOGGLE_MODES.HOVER,
302
+ heightLimit: true
299
303
  };
300
304
  }
301
305
  }]);
@@ -26,7 +26,6 @@ export default class Thumbnail extends BasePlugin {
26
26
  get usable(): boolean;
27
27
  initThumbnail(): void;
28
28
  getUrlByIndex(index: any): any;
29
- preloadImg(url: any, onload?: () => void, onerror?: () => void): void;
30
29
  preload(index: any): void;
31
30
  getPosition(now: any, containerWidth?: number, containerHeight?: number): {
32
31
  urlIndex: number;
@@ -1,5 +1,5 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
- import { createDom } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { DURATION_CHANGE } from "../../events.js";
4
4
  import "../../utils/debug.js";
5
5
  import Plugin from "../../plugin/plugin.js";
@@ -62,27 +62,6 @@ var Thumbnail = /* @__PURE__ */ function(_BasePlugin) {
62
62
  value: function getUrlByIndex(index) {
63
63
  return index >= 0 && index < this.config.urls.length ? this.config.urls[index] : "";
64
64
  }
65
- }, {
66
- key: "preloadImg",
67
- value: function preloadImg(url) {
68
- var onload = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : function() {
69
- };
70
- var onerror = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
71
- };
72
- if (!url) {
73
- return;
74
- }
75
- var img = new window.Image();
76
- img.onload = function(e) {
77
- img = null;
78
- onload && onload(e);
79
- };
80
- img.onerror = function(e) {
81
- img = null;
82
- onerror && onerror(e);
83
- };
84
- img.src = url;
85
- }
86
65
  }, {
87
66
  key: "preload",
88
67
  value: function preload(index) {
@@ -99,7 +78,7 @@ var Thumbnail = /* @__PURE__ */ function(_BasePlugin) {
99
78
  arr.map(function(item) {
100
79
  if (!_this4._preloadMark[item] && item >= 0 && item < len) {
101
80
  _this4._preloadMark[item] = 1;
102
- _this4.preloadImg(urls[item], function() {
81
+ util.preloadImg(urls[item], function() {
103
82
  _this4._preloadMark[item] = 2;
104
83
  });
105
84
  }
@@ -181,7 +160,7 @@ var Thumbnail = /* @__PURE__ */ function(_BasePlugin) {
181
160
  }, {
182
161
  key: "createThumbnail",
183
162
  value: function createThumbnail(root, className) {
184
- var dom = createDom("xg-thumbnail", "", {}, "thumbnail ".concat(className));
163
+ var dom = util.createDom("xg-thumbnail", "", {}, "thumbnail ".concat(className));
185
164
  root && root.appendChild(dom);
186
165
  return dom;
187
166
  }
@@ -0,0 +1,132 @@
1
+ .xgplayer.not-allow-autoplay .xgplayer-controls, .xgplayer.xgplayer-nostart .xgplayer-controls {
2
+ pointer-events: none;
3
+ visibility: hidden;
4
+ cursor: default;
5
+ opacity: 0;
6
+ }
7
+ .xgplayer.xgplayer-inactive .controls-autohide {
8
+ pointer-events: none;
9
+ visibility: hidden;
10
+ cursor: default;
11
+ opacity: 0;
12
+ }
13
+ .xgplayer.not-allow-autoplay .xgplayer-controls-initshow, .xgplayer.xgplayer-nostart .xgplayer-controls-initshow {
14
+ pointer-events: auto;
15
+ visibility: visible;
16
+ opacity: 1;
17
+ }
18
+ .xgplayer .xgplayer-controls {
19
+ display: block;
20
+ position: absolute;
21
+ visibility: visible;
22
+ height: 48px;
23
+ left: 0;
24
+ right: 0;
25
+ bottom: 0;
26
+ opacity: 1;
27
+ z-index: 10;
28
+ background-image: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.37), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75));
29
+ transition: opacity 0.5s ease, visibility 0.5s ease;
30
+ }
31
+ .xgplayer .xgplayer-controls.show {
32
+ display: block;
33
+ opacity: 1;
34
+ visibility: visible;
35
+ pointer-events: auto;
36
+ }
37
+ .xgplayer .xg-inner-controls {
38
+ position: absolute;
39
+ height: 40px;
40
+ bottom: 0;
41
+ justify-content: space-between;
42
+ display: flex;
43
+ }
44
+ .xgplayer .xg-left-grid, .xgplayer .xg-right-grid {
45
+ position: relative;
46
+ display: flex;
47
+ flex-wrap: wrap;
48
+ flex-shrink: 1;
49
+ height: 100%;
50
+ z-index: 1;
51
+ }
52
+ .xgplayer .xg-right-grid {
53
+ flex-direction: row-reverse;
54
+ }
55
+ .xgplayer .xg-right-grid > :first-child {
56
+ margin-right: 0;
57
+ }
58
+ .xgplayer .xg-right-grid xg-icon {
59
+ margin-left: 0;
60
+ }
61
+ .xgplayer .xg-left-grid > :first-child {
62
+ margin-left: 0;
63
+ }
64
+ .xgplayer .xg-left-grid xg-icon {
65
+ margin-right: 0;
66
+ }
67
+ .xgplayer .xg-center-grid {
68
+ display: block;
69
+ position: absolute;
70
+ left: 0;
71
+ right: 0;
72
+ outline: none;
73
+ top: -20px;
74
+ padding: 5px 0;
75
+ text-align: center;
76
+ }
77
+ .xgplayer .flex-controls .xg-inner-controls {
78
+ justify-content: space-around;
79
+ display: flex;
80
+ bottom: 8px;
81
+ }
82
+ .xgplayer .flex-controls .xg-center-grid {
83
+ display: flex;
84
+ flex: 1;
85
+ position: relative;
86
+ top: 0;
87
+ height: 100%;
88
+ justify-content: space-between;
89
+ align-items: center;
90
+ left: 0;
91
+ right: 0;
92
+ padding: 0 16px;
93
+ }
94
+ .xgplayer.xgplayer-mobile .xg-center-grid {
95
+ z-index: 2;
96
+ }
97
+ .xgplayer.xgplayer-mobile .flex-controls .xg-center-grid {
98
+ padding: 0 8px;
99
+ }
100
+ .xgplayer .bottom-controls .xg-center-grid {
101
+ top: 20px;
102
+ padding: 0;
103
+ }
104
+ .xgplayer .bottom-controls .xg-left-grid, .xgplayer .bottom-controls .xg-right-grid {
105
+ bottom: 10px;
106
+ }
107
+ .xgplayer .mini-controls {
108
+ background-image: none;
109
+ }
110
+ .xgplayer .mini-controls .xg-inner-controls {
111
+ bottom: 0;
112
+ left: 0;
113
+ right: 0;
114
+ }
115
+ .xgplayer .mini-controls .xg-center-grid {
116
+ bottom: -28px;
117
+ top: auto;
118
+ padding: 0;
119
+ }
120
+ .xgplayer .mini-controls .xg-left-grid, .xgplayer .mini-controls .xg-right-grid {
121
+ display: none;
122
+ }
123
+ .xgplayer .controls-follow {
124
+ bottom: 70px;
125
+ transition: bottom 0.3s ease;
126
+ }
127
+ .xgplayer.flex-controls .controls-follow {
128
+ bottom: 45px;
129
+ }
130
+ .xgplayer.xgplayer-inactive .controls-follow, .xgplayer.no-controls .controls-follow, .xgplayer.mini-controls .controls-follow {
131
+ bottom: 10px;
132
+ }