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
@@ -1,4 +1,4 @@
1
- import { addClass, removeClass, createDom, findDom } from "../../utils/util.js";
1
+ import util from "../../utils/util.js";
2
2
  import { DURATION_CHANGE, VIDEO_RESIZE } from "../../events.js";
3
3
  import "../../utils/debug.js";
4
4
  import "delegate";
@@ -31,9 +31,9 @@ var APIS = {
31
31
  dotDom.setAttribute("data-text", iSpot.text);
32
32
  dotDom.setAttribute("data-time", iSpot.time);
33
33
  if (ret.isMini) {
34
- addClass(dotDom, "mini");
34
+ util.addClass(dotDom, "mini");
35
35
  } else {
36
- removeClass(dotDom, "mini");
36
+ util.removeClass(dotDom, "mini");
37
37
  }
38
38
  Object.keys(style).map(function(key) {
39
39
  dotDom.style[key] = style[key];
@@ -66,7 +66,7 @@ var APIS = {
66
66
  var className = "xgspot_".concat(iSpot.id, " xgplayer-spot");
67
67
  ret.isMini && (className += " mini");
68
68
  var _t = iSpot.template ? '<div class="xgplayer-spot-pop">'.concat(iSpot.template, "</div>") : "";
69
- var dotDom = createDom("xg-spot", _t, {
69
+ var dotDom = util.createDom("xg-spot", _t, {
70
70
  "data-text": iSpot.text,
71
71
  "data-time": iSpot.time,
72
72
  "data-id": iSpot.id
@@ -193,7 +193,7 @@ var APIS = {
193
193
  });
194
194
  },
195
195
  positionDot: function positionDot(dotDom, id) {
196
- var _pop = findDom(dotDom, ".xgplayer-spot-pop");
196
+ var _pop = util.findDom(dotDom, ".xgplayer-spot-pop");
197
197
  if (!_pop) {
198
198
  return;
199
199
  }
@@ -42,9 +42,9 @@ export default class ProgressPreview extends Plugin {
42
42
  updatePosition(offset: any, cwidth: any, time: any, e: any): void;
43
43
  /**
44
44
  * @description 设置自定义时间显示字符串
45
- * @param {number} time
45
+ * @param {string} str
46
46
  */
47
- setTimeContent(time: number): void;
47
+ setTimeContent(str: string): void;
48
48
  updateThumbnails(time: any): void;
49
49
  registerThumbnail(thumbnailConfig?: {}): void;
50
50
  calcuPosition(time: any, duration: any): {
@@ -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 } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
+ import util from "../../utils/util.js";
2
3
  import sniffer from "../../utils/sniffer.js";
3
- import { hasClass, addClass, removeClass, format, createDom } from "../../utils/util.js";
4
4
  import { DURATION_CHANGE } from "../../events.js";
5
5
  import "../../utils/debug.js";
6
6
  import Plugin from "../../plugin/plugin.js";
@@ -24,12 +24,12 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
24
24
  if (_this.config.disable) {
25
25
  return;
26
26
  }
27
- if (hasClass(e.target, "xg-spot-content") && _this.config.isHideThumbnailHover) {
27
+ if (util.hasClass(e.target, "xg-spot-content") && _this.config.isHideThumbnailHover) {
28
28
  _this.player.plugins.progress.onMouseLeave(e);
29
29
  return;
30
30
  }
31
- if (_this._state.f || hasClass(e.target, "xg-spot-content")) {
32
- event(e);
31
+ if (_this._state.f || util.hasClass(e.target, "xg-spot-content")) {
32
+ util.event(e);
33
33
  e.stopPropagation();
34
34
  }
35
35
  });
@@ -37,8 +37,8 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
37
37
  if (_this.config.disable) {
38
38
  return;
39
39
  }
40
- if (_this._state.f || hasClass(e.target, "xg-spot-content")) {
41
- event(e);
40
+ if (_this._state.f || util.hasClass(e.target, "xg-spot-content")) {
41
+ util.event(e);
42
42
  e.stopPropagation();
43
43
  }
44
44
  });
@@ -67,7 +67,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
67
67
  if (_this.config.disable) {
68
68
  return;
69
69
  }
70
- if (hasClass(e.target, "xgplayer-spot") && !_this._curDot) {
70
+ if (util.hasClass(e.target, "xgplayer-spot") && !_this._curDot) {
71
71
  _this._curDot = e.target;
72
72
  _this.focusDot(e.target);
73
73
  if (_this._curDot.children.length > 0) {
@@ -108,7 +108,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
108
108
  }
109
109
  });
110
110
  this.transformTimeHook = this.hook("transformTime", function(time) {
111
- _this2.setTimeContent(time);
111
+ _this2.setTimeContent(util.format(time));
112
112
  });
113
113
  initDotsAPI(this);
114
114
  this.on(DURATION_CHANGE, function() {
@@ -185,7 +185,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
185
185
  return;
186
186
  }
187
187
  this.isDrag = true;
188
- this.videoPreview && addClass(this.videoPreview, "show");
188
+ this.videoPreview && util.addClass(this.videoPreview, "show");
189
189
  }
190
190
  }, {
191
191
  key: "onProgressDragEnd",
@@ -194,7 +194,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
194
194
  return;
195
195
  }
196
196
  this.isDrag = false;
197
- this.videoPreview && removeClass(this.videoPreview, "show");
197
+ this.videoPreview && util.removeClass(this.videoPreview, "show");
198
198
  }
199
199
  }, {
200
200
  key: "onProgressClick",
@@ -202,7 +202,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
202
202
  if (this.config.disable) {
203
203
  return;
204
204
  }
205
- if (hasClass(e.target, "xgplayer-spot")) {
205
+ if (util.hasClass(e.target, "xgplayer-spot")) {
206
206
  e.stopPropagation();
207
207
  e.preventDefault();
208
208
  ["time", "id", "text"].map(function(key) {
@@ -254,7 +254,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
254
254
  _state.now = time;
255
255
  this.transformTimeHook(time);
256
256
  var timeStr = this.timeStr;
257
- if (e && e.target && hasClass(e.target, "xgplayer-spot")) {
257
+ if (e && e.target && util.hasClass(e.target, "xgplayer-spot")) {
258
258
  this.showTips(e.target.getAttribute("data-text"), false, timeStr);
259
259
  this.focusDot(e.target);
260
260
  _state.f = true;
@@ -272,8 +272,8 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
272
272
  }
273
273
  }, {
274
274
  key: "setTimeContent",
275
- value: function setTimeContent(time) {
276
- this.timeStr = "".concat(format(time));
275
+ value: function setTimeContent(str) {
276
+ this.timeStr = str;
277
277
  }
278
278
  }, {
279
279
  key: "updateThumbnails",
@@ -299,19 +299,19 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
299
299
  thumbnail.setConfig(thumbnailConfig);
300
300
  }
301
301
  if (!thumbnail || !thumbnail.usable || !config.isShowThumbnail) {
302
- addClass(this.root, "short-line no-thumbnail");
302
+ util.addClass(this.root, "short-line no-thumbnail");
303
303
  return;
304
304
  } else {
305
- removeClass(this.root, "short-line no-thumbnail");
305
+ util.removeClass(this.root, "short-line no-thumbnail");
306
306
  }
307
307
  if (config.mode === "short") {
308
- addClass(this.root, "short-line");
308
+ util.addClass(this.root, "short-line");
309
309
  }
310
310
  this._hasThumnail = true;
311
311
  var tRoot = this.find(".xg-spot-thumbnail");
312
312
  this.thumbnail = thumbnail.createThumbnail(tRoot, "progress-thumbnail");
313
313
  if (config.isShowCoverPreview) {
314
- this.videoPreview = createDom("xg-video-preview", "", {}, "xgvideo-preview");
314
+ this.videoPreview = util.createDom("xg-video-preview", "", {}, "xgvideo-preview");
315
315
  player.root.appendChild(this.videoPreview);
316
316
  this.videothumbnail = thumbnail.createThumbnail(this.videoPreview, "xgvideo-thumbnail");
317
317
  }
@@ -355,7 +355,7 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
355
355
  if (!id) {
356
356
  id = target.getAttribute("data-id");
357
357
  }
358
- addClass(target, "active");
358
+ util.addClass(target, "active");
359
359
  this._activeDotId = id;
360
360
  }
361
361
  }, {
@@ -368,43 +368,43 @@ var ProgressPreview = /* @__PURE__ */ function(_Plugin) {
368
368
  if (!target) {
369
369
  return;
370
370
  }
371
- removeClass(target, "active");
371
+ util.removeClass(target, "active");
372
372
  this._activeDotId = null;
373
373
  }
374
374
  }, {
375
375
  key: "showTips",
376
376
  value: function showTips(text, isDefault) {
377
377
  var timeStr = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : "";
378
- addClass(this.root, "no-timepoint");
378
+ util.addClass(this.root, "no-timepoint");
379
379
  if (!text) {
380
380
  return;
381
381
  }
382
- addClass(this.find(".xg-spot-content"), "show-text");
382
+ util.addClass(this.find(".xg-spot-content"), "show-text");
383
383
  if (isDefault && this.config.mode === "production") {
384
- addClass(this.root, "product");
384
+ util.addClass(this.root, "product");
385
385
  this.tipText.textContent = text;
386
386
  } else {
387
- removeClass(this.root, "product");
387
+ util.removeClass(this.root, "product");
388
388
  this.tipText.textContent = this._hasThumnail ? text : "".concat(timeStr, " ").concat(text);
389
389
  }
390
390
  }
391
391
  }, {
392
392
  key: "hideTips",
393
393
  value: function hideTips() {
394
- removeClass(this.root, "no-timepoint");
394
+ util.removeClass(this.root, "no-timepoint");
395
395
  this.tipText.textContent = "";
396
- removeClass(this.find(".xg-spot-content"), "show-text");
397
- removeClass(this.root, "product");
396
+ util.removeClass(this.find(".xg-spot-content"), "show-text");
397
+ util.removeClass(this.root, "product");
398
398
  }
399
399
  }, {
400
400
  key: "hide",
401
401
  value: function hide() {
402
- addClass(this.root, "hide");
402
+ util.addClass(this.root, "hide");
403
403
  }
404
404
  }, {
405
405
  key: "show",
406
406
  value: function show() {
407
- removeClass(this.root, "hide");
407
+ util.removeClass(this.root, "hide");
408
408
  }
409
409
  }, {
410
410
  key: "enable",
@@ -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 { addClass, removeClass } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import "../../utils/debug.js";
4
4
  import Plugin from "../../plugin/plugin.js";
5
5
  import STATE_CLASS from "../../stateClassMap.js";
@@ -54,8 +54,8 @@ var Prompt = /* @__PURE__ */ function(_Plugin) {
54
54
  clearTimeout(this.intervalId);
55
55
  this.intervalId = null;
56
56
  }
57
- addClass(this.root, "show");
58
- config.mode === "arrow" && addClass(this.root, "arrow");
57
+ util.addClass(this.root, "show");
58
+ config.mode === "arrow" && util.addClass(this.root, "arrow");
59
59
  if (typeof detail === "string") {
60
60
  this.find(".xgplayer-prompt-detail").innerHTML = detail;
61
61
  } else {
@@ -73,8 +73,8 @@ var Prompt = /* @__PURE__ */ function(_Plugin) {
73
73
  }, {
74
74
  key: "hide",
75
75
  value: function hide() {
76
- removeClass(this.root, "show");
77
- removeClass(this.root, "arrow");
76
+ util.removeClass(this.root, "show");
77
+ util.removeClass(this.root, "arrow");
78
78
  this.root.removeAttribute("style");
79
79
  this.customOnClick = null;
80
80
  }
@@ -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 { addClass, removeClass } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { ENDED, PLAY } from "../../events.js";
4
4
  import "../../utils/debug.js";
5
5
  import Plugin from "../../plugin/plugin.js";
@@ -34,7 +34,7 @@ var Replay = /* @__PURE__ */ function(_Plugin) {
34
34
  this.bind(".xgplayer-replay", ["click", "touchend"], this.__handleReplay);
35
35
  this.on(ENDED, function() {
36
36
  if (!_this.playerConfig.loop) {
37
- addClass(_this.player.root, "replay");
37
+ util.addClass(_this.player.root, "replay");
38
38
  }
39
39
  if (_this.config.disable) {
40
40
  return;
@@ -60,7 +60,7 @@ var Replay = /* @__PURE__ */ function(_Plugin) {
60
60
  e.preventDefault();
61
61
  e.stopPropagation();
62
62
  this.player.replay();
63
- removeClass(this.player.root, "replay");
63
+ util.removeClass(this.player.root, "replay");
64
64
  }
65
65
  }, {
66
66
  key: "show",
@@ -1,5 +1,5 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
- import { setTimeout } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { VIDEO_RESIZE, ROTATE } from "../../events.js";
4
4
  import "../../utils/debug.js";
5
5
  import { POSITIONS } from "../../plugin/plugin.js";
@@ -29,7 +29,7 @@ var Rotate = /* @__PURE__ */ function(_IconPlugin) {
29
29
  this.bind(".xgplayer-icon", ["click", "touchend"], this.onBtnClick);
30
30
  this.on(VIDEO_RESIZE, function() {
31
31
  if (_this2.rotateDeg && _this2.config.innerRotate) {
32
- setTimeout(_this2, function() {
32
+ util.setTimeout(_this2, function() {
33
33
  _this2.updateRotateDeg(_this2.rotateDeg, _this2.config.innerRotate);
34
34
  }, 100);
35
35
  }
@@ -7,6 +7,7 @@ export default class ScreenShot extends IconPlugin {
7
7
  format: string;
8
8
  width: number;
9
9
  height: number;
10
+ saveImg: boolean;
10
11
  fitVideo: boolean;
11
12
  disable: boolean;
12
13
  name: string;
@@ -1,6 +1,7 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
- import "../../utils/debug.js";
2
+ import "../../utils/util.js";
3
3
  import { VIDEO_RESIZE, SCREEN_SHOT } from "../../events.js";
4
+ import "../../utils/debug.js";
4
5
  import { POSITIONS } from "../../plugin/plugin.js";
5
6
  import Icon from "../common/iconPlugin.js";
6
7
  var ScreenShot = /* @__PURE__ */ function(_IconPlugin) {
@@ -69,9 +70,12 @@ var ScreenShot = /* @__PURE__ */ function(_IconPlugin) {
69
70
  e.preventDefault();
70
71
  e.stopPropagation();
71
72
  this.emitUserAction(e, "shot");
72
- this.shot().then(function(data) {
73
+ var config = this.config;
74
+ this.shot(config.width, config.height).then(function(data) {
73
75
  _this.emit(SCREEN_SHOT, data);
74
- _this.saveScreenShot(data, _this.config.name + _this.config.format);
76
+ if (config.saveImg) {
77
+ _this.saveScreenShot(data, config.name + config.format);
78
+ }
75
79
  });
76
80
  }
77
81
  }, {
@@ -166,6 +170,7 @@ var ScreenShot = /* @__PURE__ */ function(_IconPlugin) {
166
170
  format: ".png",
167
171
  width: 600,
168
172
  height: 337,
173
+ saveImg: true,
169
174
  fitVideo: true,
170
175
  disable: false,
171
176
  name: "screenshot"
@@ -1,5 +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 { removeClass, addClass } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { READY, AUTOPLAY_STARTED, AUTOPLAY_PREVENTED, PLAY, PAUSE, RESET } from "../../events.js";
4
4
  import "../../utils/debug.js";
5
5
  import Plugin from "../../plugin/plugin.js";
@@ -45,7 +45,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
45
45
  _this.autoPlayStart = false;
46
46
  var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
47
47
  _this.setAttr("data-state", "play");
48
- removeClass(_this.root, className);
48
+ util.removeClass(_this.root, className);
49
49
  _this.show();
50
50
  });
51
51
  _defineProperty(_assertThisInitialized(_this), "onAutoplayStart", function() {
@@ -53,7 +53,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
53
53
  return;
54
54
  }
55
55
  var className = _this.config.mode === "auto" ? "auto-hide" : "hide";
56
- addClass(_this.root, className);
56
+ util.addClass(_this.root, className);
57
57
  _this.autoPlayStart = true;
58
58
  _this.onPlayPause("play");
59
59
  });
@@ -69,9 +69,9 @@ var Start = /* @__PURE__ */ function(_Plugin) {
69
69
  this.once(READY, function() {
70
70
  if (playerConfig) {
71
71
  if (playerConfig.lang && playerConfig.lang === "en") {
72
- addClass(player.root, "lang-is-en");
72
+ util.addClass(player.root, "lang-is-en");
73
73
  } else if (playerConfig.lang === "jp") {
74
- addClass(player.root, "lang-is-jp");
74
+ util.addClass(player.root, "lang-is-jp");
75
75
  }
76
76
  }
77
77
  });
@@ -82,7 +82,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
82
82
  this.on(AUTOPLAY_PREVENTED, function() {
83
83
  var className = _this2.config.mode === "auto" ? "auto-hide" : "hide";
84
84
  _this2.setAttr("data-state", "play");
85
- removeClass(_this2.root, className);
85
+ util.removeClass(_this2.root, className);
86
86
  _this2.show();
87
87
  });
88
88
  this.on(PLAY, function() {
@@ -132,22 +132,22 @@ var Start = /* @__PURE__ */ function(_Plugin) {
132
132
  }, {
133
133
  key: "hide",
134
134
  value: function hide() {
135
- addClass(this.root, "hide");
135
+ util.addClass(this.root, "hide");
136
136
  }
137
137
  }, {
138
138
  key: "show",
139
139
  value: function show() {
140
- removeClass(this.root, "hide");
140
+ util.removeClass(this.root, "hide");
141
141
  }
142
142
  }, {
143
143
  key: "focusHide",
144
144
  value: function focusHide() {
145
- addClass(this.root, "focus-hide");
145
+ util.addClass(this.root, "focus-hide");
146
146
  }
147
147
  }, {
148
148
  key: "recover",
149
149
  value: function recover() {
150
- removeClass(this.root, "focus-hide");
150
+ util.removeClass(this.root, "focus-hide");
151
151
  }
152
152
  }, {
153
153
  key: "switchStatus",
@@ -164,12 +164,12 @@ var Start = /* @__PURE__ */ function(_Plugin) {
164
164
  var _this3 = this;
165
165
  this._animateId = addAnimate("pauseplay", 400, {
166
166
  start: function start() {
167
- addClass(_this3.root, "interact");
167
+ util.addClass(_this3.root, "interact");
168
168
  _this3.show();
169
169
  _this3.switchStatus(true);
170
170
  },
171
171
  end: function end() {
172
- removeClass(_this3.root, "interact");
172
+ util.removeClass(_this3.root, "interact");
173
173
  !endShow && _this3.hide();
174
174
  _this3._animateId = null;
175
175
  }
@@ -178,7 +178,7 @@ var Start = /* @__PURE__ */ function(_Plugin) {
178
178
  }, {
179
179
  key: "endAnimate",
180
180
  value: function endAnimate() {
181
- removeClass(this.root, "interact");
181
+ util.removeClass(this.root, "interact");
182
182
  clearAnimation(this._animateId);
183
183
  this._animateId = null;
184
184
  }
@@ -1,5 +1,5 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, objectSpread2 as _objectSpread2, assertThisInitialized as _assertThisInitialized, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
- import "../../utils/debug.js";
2
+ import "../../utils/util.js";
3
3
  import { USER_ACTION, STATS_EVENTS as STATS_EVENTS$1 } from "../../events.js";
4
4
  import BasePlugin from "../../plugin/basePlugin.js";
5
5
  import "delegate";
@@ -1,5 +1,5 @@
1
1
  import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, toConsumableArray as _toConsumableArray } from "../../_virtual/_rollupPluginBabelHelpers.js";
2
- import { isMSE } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { DOWNLOAD_SPEED_CHANGE, LOADED_DATA, REPLAY } from "../../events.js";
4
4
  import "../../utils/debug.js";
5
5
  import Plugin from "../../plugin/plugin.js";
@@ -28,7 +28,7 @@ var TestSpeed = /* @__PURE__ */ function(_BasePlugin) {
28
28
  return Math.floor(total / _this.speedListCache[type].length);
29
29
  });
30
30
  _defineProperty(_assertThisInitialized(_this), "startTimer", function() {
31
- if (isMSE(_this.player.video)) {
31
+ if (util.isMSE(_this.player.video)) {
32
32
  return;
33
33
  }
34
34
  _this.initSpeedList();
@@ -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 { format, createDom, hide, show, adjustTimeByDuration } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { DURATION_CHANGE, SEEKED, TIME_UPDATE, ENDED, EMPTIED } from "../../events.js";
4
4
  import "../../utils/debug.js";
5
5
  import Plugin, { POSITIONS } from "../../plugin/plugin.js";
@@ -45,7 +45,10 @@ var Time = /* @__PURE__ */ function(_Plugin) {
45
45
  }
46
46
  this.durationDom = this.find(".time-duration");
47
47
  this.timeDom = this.find(".time-current");
48
- this.on([DURATION_CHANGE, SEEKED, TIME_UPDATE], function() {
48
+ this.on([DURATION_CHANGE, SEEKED, TIME_UPDATE], function(e) {
49
+ if (e.eventName === "durationchange") {
50
+ _this2.isActiving = false;
51
+ }
49
52
  _this2.onTimeUpdate();
50
53
  });
51
54
  this.on(ENDED, function() {
@@ -57,7 +60,7 @@ var Time = /* @__PURE__ */ function(_Plugin) {
57
60
  }
58
61
  }, {
59
62
  key: "show",
60
- value: function show2() {
63
+ value: function show() {
61
64
  if (this.mode === "flex") {
62
65
  this.centerCurDom && (this.centerCurDom.style.display = "block");
63
66
  this.centerDurDom && (this.centerDurDom.style.display = "block");
@@ -67,7 +70,7 @@ var Time = /* @__PURE__ */ function(_Plugin) {
67
70
  }
68
71
  }, {
69
72
  key: "hide",
70
- value: function hide2() {
73
+ value: function hide() {
71
74
  if (this.mode === "flex") {
72
75
  this.centerCurDom && (this.centerCurDom.style.display = "none");
73
76
  this.centerDurDom && (this.centerDurDom.style.display = "none");
@@ -83,16 +86,16 @@ var Time = /* @__PURE__ */ function(_Plugin) {
83
86
  return;
84
87
  }
85
88
  var current = this.currentTime + this.timeOffset;
86
- current = adjustTimeByDuration(current, duration, isEnded);
89
+ current = util.adjustTimeByDuration(current, duration, isEnded);
87
90
  if (this.mode === "flex") {
88
- this.centerCurDom.innerHTML = this.minWidthTime(format(current));
91
+ this.centerCurDom.innerHTML = this.minWidthTime(util.format(current));
89
92
  if (duration !== Infinity && duration > 0) {
90
- this.centerDurDom.innerHTML = format(duration);
93
+ this.centerDurDom.innerHTML = util.format(duration);
91
94
  }
92
95
  } else {
93
- this.timeDom.innerHTML = this.minWidthTime(format(current));
96
+ this.timeDom.innerHTML = this.minWidthTime(util.format(current));
94
97
  if (duration !== Infinity && duration > 0) {
95
- this.durationDom.innerHTML = format(duration);
98
+ this.durationDom.innerHTML = util.format(duration);
96
99
  }
97
100
  }
98
101
  }
@@ -100,11 +103,11 @@ var Time = /* @__PURE__ */ function(_Plugin) {
100
103
  key: "onReset",
101
104
  value: function onReset() {
102
105
  if (this.mode === "flex") {
103
- this.centerCurDom.innerHTML = this.minWidthTime(format(0));
104
- this.centerDurDom.innerHTML = format(0);
106
+ this.centerCurDom.innerHTML = this.minWidthTime(util.format(0));
107
+ this.centerDurDom.innerHTML = util.format(0);
105
108
  } else {
106
- this.timeDom.innerHTML = this.minWidthTime(format(0));
107
- this.durationDom.innerHTML = format(0);
109
+ this.timeDom.innerHTML = this.minWidthTime(util.format(0));
110
+ this.durationDom.innerHTML = util.format(0);
108
111
  }
109
112
  }
110
113
  }, {
@@ -115,8 +118,8 @@ var Time = /* @__PURE__ */ function(_Plugin) {
115
118
  return;
116
119
  }
117
120
  var center = player.controls.center;
118
- this.centerCurDom = createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-left");
119
- this.centerDurDom = createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-right");
121
+ this.centerCurDom = util.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-left");
122
+ this.centerDurDom = util.createDom("xg-icon", "00:00", {}, "xgplayer-time xg-time-right");
120
123
  center.children.length > 0 ? center.insertBefore(this.centerCurDom, center.children[0]) : center.appendChild(this.centerCurDom);
121
124
  center.appendChild(this.centerDurDom);
122
125
  }
@@ -125,12 +128,12 @@ var Time = /* @__PURE__ */ function(_Plugin) {
125
128
  value: function afterPlayerInit() {
126
129
  var config = this.config;
127
130
  if (this.duration === Infinity || this.playerConfig.isLive) {
128
- hide(this.durationDom);
129
- hide(this.timeDom);
130
- hide(this.find(".time-separator"));
131
- show(this.find(".time-live-tag"));
131
+ util.hide(this.durationDom);
132
+ util.hide(this.timeDom);
133
+ util.hide(this.find(".time-separator"));
134
+ util.show(this.find(".time-live-tag"));
132
135
  } else {
133
- hide(this.find(".time-live-tag"));
136
+ util.hide(this.find(".time-live-tag"));
134
137
  }
135
138
  if (config.hide) {
136
139
  this.hide();
@@ -142,15 +145,15 @@ var Time = /* @__PURE__ */ function(_Plugin) {
142
145
  key: "changeLiveState",
143
146
  value: function changeLiveState(isLive) {
144
147
  if (isLive) {
145
- hide(this.durationDom);
146
- hide(this.timeDom);
147
- hide(this.find(".time-separator"));
148
- show(this.find(".time-live-tag"));
148
+ util.hide(this.durationDom);
149
+ util.hide(this.timeDom);
150
+ util.hide(this.find(".time-separator"));
151
+ util.show(this.find(".time-live-tag"));
149
152
  } else {
150
- hide(this.find(".time-live-tag"));
151
- show(this.find(".time-separator"));
152
- show(this.durationDom);
153
- show(this.timeDom);
153
+ util.hide(this.find(".time-live-tag"));
154
+ util.show(this.find(".time-separator"));
155
+ util.show(this.durationDom);
156
+ util.show(this.timeDom);
154
157
  }
155
158
  }
156
159
  }, {
@@ -161,10 +164,10 @@ var Time = /* @__PURE__ */ function(_Plugin) {
161
164
  return;
162
165
  }
163
166
  if (this.mode === "flex") {
164
- this.centerCurDom.innerHTML = this.minWidthTime(format(time));
167
+ this.centerCurDom.innerHTML = this.minWidthTime(util.format(time));
165
168
  return;
166
169
  }
167
- this.timeDom.innerHTML = this.minWidthTime(format(time));
170
+ this.timeDom.innerHTML = this.minWidthTime(util.format(time));
168
171
  }
169
172
  }, {
170
173
  key: "minWidthTime",
@@ -182,7 +185,7 @@ var Time = /* @__PURE__ */ function(_Plugin) {
182
185
  _this3.isActiving = false;
183
186
  };
184
187
  this.off(SEEKED, updateState);
185
- if (player.isSeeking) {
188
+ if (player.isSeeking && player.media.seeking) {
186
189
  this.once(SEEKED, updateState);
187
190
  } else {
188
191
  this.isActiving = false;
@@ -1,5 +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 { getIndexByTime, getOffsetCurrentTime } from "../../utils/util.js";
2
+ import util from "../../utils/util.js";
3
3
  import { DURATION_CHANGE, LOADED_DATA, TIME_UPDATE, SEEKING, PLAY } from "../../events.js";
4
4
  import BasePlugin from "../../plugin/basePlugin.js";
5
5
  import "delegate";
@@ -19,8 +19,8 @@ var TimeSegmentsControls = /* @__PURE__ */ function(_BasePlugin) {
19
19
  if (!_this._checkIfEnabled(timeSegments)) {
20
20
  return;
21
21
  }
22
- var index = getIndexByTime(currentTime, timeSegments);
23
- var time = getOffsetCurrentTime(currentTime, timeSegments, index);
22
+ var index = util.getIndexByTime(currentTime, timeSegments);
23
+ var time = util.getOffsetCurrentTime(currentTime, timeSegments, index);
24
24
  _this.player.offsetCurrentTime = time;
25
25
  _this.changeIndex(index, timeSegments);
26
26
  });
@@ -29,7 +29,7 @@ var TimeSegmentsControls = /* @__PURE__ */ function(_BasePlugin) {
29
29
  if (!_this._checkIfEnabled(timeSegments)) {
30
30
  return;
31
31
  }
32
- var time = getOffsetCurrentTime(0, timeSegments);
32
+ var time = util.getOffsetCurrentTime(0, timeSegments);
33
33
  _this.player.offsetCurrentTime = time;
34
34
  _this.changeIndex(0, timeSegments);
35
35
  if (_this.curPos.start > 0) {
@@ -43,11 +43,11 @@ var TimeSegmentsControls = /* @__PURE__ */ function(_BasePlugin) {
43
43
  }
44
44
  var _len = timeSegments.length;
45
45
  _this.lastCurrentTime = currentTime;
46
- var index = getIndexByTime(currentTime, timeSegments);
46
+ var index = util.getIndexByTime(currentTime, timeSegments);
47
47
  if (index !== _this.curIndex) {
48
48
  _this.changeIndex(index, timeSegments);
49
49
  }
50
- var curTime = getOffsetCurrentTime(currentTime, timeSegments, index);
50
+ var curTime = util.getOffsetCurrentTime(currentTime, timeSegments, index);
51
51
  _this.player.offsetCurrentTime = curTime;
52
52
  if (!_this.curPos) {
53
53
  return;
@@ -69,7 +69,7 @@ var TimeSegmentsControls = /* @__PURE__ */ function(_BasePlugin) {
69
69
  } else if (currentTime > timeSegments[timeSegments.length - 1].end) {
70
70
  _this.player.currentTime = timeSegments[timeSegments.length - 1].end;
71
71
  } else {
72
- var _index = getIndexByTime(currentTime, timeSegments);
72
+ var _index = util.getIndexByTime(currentTime, timeSegments);
73
73
  if (_index >= 0) {
74
74
  var _seekTime = _this.getSeekTime(currentTime, _this.lastCurrentTime, _index, timeSegments);
75
75
  if (_seekTime >= 0) {