xgplayer 3.0.17-alpha.2 → 3.0.17-alpha.4

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.
package/es/index.css CHANGED
@@ -500,6 +500,9 @@
500
500
  .xgplayer-mobile .xg-options-list li:hover {
501
501
  color: rgb(255, 255, 255);
502
502
  }
503
+ .xgplayer-mobile .xg-options-list li.selected {
504
+ color: #FF0000;
505
+ }
503
506
  }
504
507
  .xgplayer xg-thumbnail {
505
508
  display: block;
@@ -154,9 +154,12 @@
154
154
  }
155
155
  }
156
156
  .xg-options-list li {
157
- &:hover{
157
+ &:hover {
158
158
  color: $definitionLiColor;
159
159
  }
160
+ &.selected {
161
+ color: $definitionLiActiveColor;
162
+ }
160
163
  }
161
164
  }
162
165
  }
@@ -24,6 +24,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
24
24
  _this = _super.call(this, options);
25
25
  _defineProperty(_assertThisInitialized(_this), "onTouchStart", function(e) {
26
26
  var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player, config = _assertThisInitialize.config, pos = _assertThisInitialize.pos, playerConfig = _assertThisInitialize.playerConfig;
27
+ console.log(">>>onTouchStart Mobile");
27
28
  var touche = _this.getTouche(e);
28
29
  if (touche && !config.disableGesture && _this.duration > 0 && !player.ended) {
29
30
  pos.isStart = true;
@@ -88,8 +89,9 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
88
89
  });
89
90
  _defineProperty(_assertThisInitialized(_this), "onTouchEnd", function(e) {
90
91
  var _assertThisInitialize3 = _assertThisInitialized(_this), player = _assertThisInitialize3.player, pos = _assertThisInitialize3.pos, playerConfig = _assertThisInitialize3.playerConfig;
92
+ console.log(">>>onTouchEnd Mobile");
91
93
  setTimeout(function() {
92
- player.getPlugin("progress") && player.getPlugin("progress").resetSeekState();
94
+ player.getPlugin("progress") && player.getPlugin("progress").recoverSeekState();
93
95
  }, 10);
94
96
  if (!pos.isStart) {
95
97
  return;
@@ -230,6 +232,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
230
232
  });
231
233
  ["dragend", "click"].forEach(function(key) {
232
234
  progressPlugin.addCallBack(key, function() {
235
+ console.log(">>>>progressPlugin callback", key);
233
236
  _this2.changeAction(ACTIONS.AUTO);
234
237
  });
235
238
  });
@@ -303,6 +306,7 @@ var MobilePlugin = /* @__PURE__ */ function(_Plugin) {
303
306
  key: "changeAction",
304
307
  value: function changeAction(action) {
305
308
  var player = this.player, root = this.root;
309
+ console.log(">>>>changeAction", action);
306
310
  root.setAttribute("data-xg-action", action);
307
311
  var startPlugin = player.plugins.start;
308
312
  startPlugin && startPlugin.recover();
@@ -99,7 +99,7 @@ declare class Progress extends Plugin {
99
99
  */
100
100
  removeCallBack(type: string, event: Function): void;
101
101
  /**
102
- * @description 解除进度条的所动状态
102
+ * @description 解除进度条的锁定状态
103
103
  * @returns
104
104
  */
105
105
  unlock(): void;
@@ -121,6 +121,8 @@ declare class Progress extends Plugin {
121
121
  _mouseDownHandler: (event: any, data: any) => void;
122
122
  _mouseUpHandler: (e: any, data: any) => void;
123
123
  _mouseMoveHandler: (e: any, data: any) => void;
124
+ onControlsMove: (e: any) => void;
125
+ onControlsEnd: (e: any) => void;
124
126
  onMouseDown: (e: any) => boolean;
125
127
  onMouseUp: (e: any) => void;
126
128
  onMouseMove: (e: any) => void;
@@ -155,7 +157,8 @@ declare class Progress extends Plugin {
155
157
  /**
156
158
  * @description 复位正在拖拽状态 ,拖拽的时候要避免timeupdate更新
157
159
  */
158
- resetSeekState(): void;
160
+ recoverSeekState(): void;
161
+ setSeekState(): void;
159
162
  /**
160
163
  * @description 拖拽过程中更新UI
161
164
  * @param {number} percent 小于0的小数
@@ -29,8 +29,8 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
29
29
  pos.moving = true;
30
30
  pos.x = x;
31
31
  ret = _this.computeTime(e, x);
32
+ _this.triggerCallbacks("dragmove", ret, e);
32
33
  }
33
- _this.triggerCallbacks("dragmove", ret, e);
34
34
  _this._updateInnerFocus(ret);
35
35
  });
36
36
  _defineProperty(_assertThisInitialized(_this), "onBodyClick", function(e) {
@@ -68,7 +68,16 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
68
68
  _this.triggerCallbacks("dragmove", data, e);
69
69
  _this._updateInnerFocus(data);
70
70
  });
71
+ _defineProperty(_assertThisInitialized(_this), "onControlsMove", function(e) {
72
+ util.stopPropagation(e);
73
+ console.log("onControlsMove", e.type);
74
+ });
75
+ _defineProperty(_assertThisInitialized(_this), "onControlsEnd", function(e) {
76
+ console.log("onControlsEnd", e.type);
77
+ util.stopPropagation(e);
78
+ });
71
79
  _defineProperty(_assertThisInitialized(_this), "onMouseDown", function(e) {
80
+ console.log(">>>onMouseDown");
72
81
  var _assertThisInitialize4 = _assertThisInitialized(_this), _state = _assertThisInitialize4._state, player = _assertThisInitialize4.player, pos = _assertThisInitialize4.pos, config = _assertThisInitialize4.config, playerConfig = _assertThisInitialize4.playerConfig;
73
82
  var _ePos = util.getEventPos(e, player.zoom);
74
83
  var x = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
@@ -110,6 +119,7 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
110
119
  });
111
120
  _defineProperty(_assertThisInitialized(_this), "onMouseUp", function(e) {
112
121
  var _assertThisInitialize5 = _assertThisInitialized(_this), player = _assertThisInitialize5.player, config = _assertThisInitialize5.config, pos = _assertThisInitialize5.pos, playerConfig = _assertThisInitialize5.playerConfig, _state = _assertThisInitialize5._state;
122
+ console.log("onMouseUp", e.type);
113
123
  e.stopPropagation();
114
124
  e.preventDefault();
115
125
  util.checkIsFunction(playerConfig.enableSwipeHandler) && playerConfig.enableSwipeHandler();
@@ -119,13 +129,16 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
119
129
  var ret = _this.computeTime(e, pos.x);
120
130
  ret.prePlayTime = _state.prePlayTime;
121
131
  if (pos.moving) {
132
+ console.log(">>>>triggerCallbacks dragend");
122
133
  _this.triggerCallbacks("dragend", ret, e);
123
134
  _this.emitUserAction("drag", "dragend", ret);
124
135
  } else {
136
+ console.log(">>>>triggerCallbacks click");
125
137
  _this.triggerCallbacks("click", ret, e);
126
138
  _this.emitUserAction("click", "click", ret);
127
139
  }
128
140
  _this._mouseUpHandlerHook(e, ret);
141
+ console.log(">>>>after _mouseUpHandlerHook");
129
142
  pos.moving = false;
130
143
  pos.isDown = false;
131
144
  pos.x = 0;
@@ -135,6 +148,7 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
135
148
  _state.time = 0;
136
149
  var eventType = e.type;
137
150
  if (eventType === "touchend" || eventType === "touchcancel") {
151
+ console.log(">>>>removeEventListener");
138
152
  _this.root.removeEventListener("touchmove", _this.onMouseMove);
139
153
  _this.root.removeEventListener("touchend", _this.onMouseUp);
140
154
  _this.root.removeEventListener("touchcancel", _this.onMouseUp);
@@ -148,9 +162,14 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
148
162
  playerConfig.isMobileSimulateMode !== "mobile" && _this.bind("mousemove", _this.onMoveOnly);
149
163
  }
150
164
  }
165
+ console.log(">>>>setTimeout recoverSeekState");
166
+ if (eventType === "touchcancel") {
167
+ _this.recoverSeekState();
168
+ }
151
169
  util.setTimeout(_assertThisInitialized(_this), function() {
152
- _this.resetSeekState();
153
- }, 1);
170
+ console.log(">>>>recoverSeekState");
171
+ _this.recoverSeekState();
172
+ }, 10);
154
173
  player.focus();
155
174
  });
156
175
  _defineProperty(_assertThisInitialized(_this), "onMouseMove", function(e) {
@@ -162,10 +181,15 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
162
181
  var _ePos = util.getEventPos(e, player.zoom);
163
182
  var x = player.rotateDeg === 90 ? _ePos.clientY : _ePos.clientX;
164
183
  var diff = Math.abs(pos.x - x);
165
- if (pos.moving && diff < config.miniMoveStep || !pos.moving && diff < config.miniStartStep) {
184
+ if (!pos.isDown || pos.moving && diff < config.miniMoveStep || !pos.moving && diff < config.miniStartStep) {
185
+ console.log(">>>onMouseMove11", "pos.isDown:".concat(pos.isDown, " isProgressMoving:").concat(_this.isProgressMoving));
166
186
  return;
167
187
  }
168
188
  pos.x = x;
189
+ if (config.disable) {
190
+ return;
191
+ }
192
+ _this.isProgressMoving = true;
169
193
  var ret = _this.computeTime(e, x);
170
194
  ret.prePlayTime = _state.prePlayTime;
171
195
  _this._mouseMoveHandlerHook(e, ret);
@@ -192,7 +216,7 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
192
216
  _this.focus();
193
217
  });
194
218
  _defineProperty(_assertThisInitialized(_this), "onMouseLeave", function(e) {
195
- _this.triggerCallbacks("mouseleave", null, e);
219
+ e && _this.triggerCallbacks("mouseleave", null, e);
196
220
  _this.unlock();
197
221
  _this._updateInnerFocus(null);
198
222
  });
@@ -424,16 +448,12 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
424
448
  }, {
425
449
  key: "bindDomEvents",
426
450
  value: function bindDomEvents() {
427
- var _this$player2 = this.player, controls = _this$player2.controls, config = _this$player2.config;
451
+ var config = this.player.config;
428
452
  this._mouseDownHandlerHook = this.hook("dragstart", this._mouseDownHandler);
429
453
  this._mouseUpHandlerHook = this.hook("dragend", this._mouseUpHandler);
430
454
  this._mouseMoveHandlerHook = this.hook("drag", this._mouseMoveHandler);
431
455
  if (this.domEventType === "touch" || this.domEventType === "compatible") {
432
456
  this.root.addEventListener("touchstart", this.onMouseDown);
433
- if (controls) {
434
- controls.root && controls.root.addEventListener("touchmove", util.stopPropagation);
435
- controls.center && controls.center.addEventListener("touchend", util.stopPropagation);
436
- }
437
457
  }
438
458
  if (this.domEventType === "mouse" || this.domEventType === "compatible") {
439
459
  this.bind("mousedown", this.onMouseDown);
@@ -530,16 +550,20 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
530
550
  }
531
551
  }
532
552
  }, {
533
- key: "resetSeekState",
534
- value: function resetSeekState() {
553
+ key: "recoverSeekState",
554
+ value: function recoverSeekState() {
535
555
  this.isProgressMoving = false;
536
556
  var timeIcon = this.player.plugins.time;
537
557
  timeIcon && timeIcon.resetActive();
538
558
  }
559
+ }, {
560
+ key: "setSeekState",
561
+ value: function setSeekState() {
562
+ this.isProgressMoving = true;
563
+ }
539
564
  }, {
540
565
  key: "updatePercent",
541
566
  value: function updatePercent(percent, notSeek) {
542
- this.isProgressMoving = true;
543
567
  if (this.config.disable) {
544
568
  return;
545
569
  }
@@ -558,6 +582,7 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
558
582
  value: function onTimeupdate(isEnded) {
559
583
  var player = this.player, _state = this._state, offsetDuration = this.offsetDuration;
560
584
  if (player.isSeeking && player.media.seeking || this.isProgressMoving || !player.hasStart) {
585
+ console.log(">>>onTimeupdate", "isSeeking:".concat(player.isSeeking, " seeking:").concat(player.media.seeking, " isProgressMoving:").concat(this.isProgressMoving, " hasStart:").concat(player.hasStart));
561
586
  return;
562
587
  }
563
588
  if (_state.now > -1) {
@@ -602,7 +627,6 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
602
627
  key: "destroy",
603
628
  value: function destroy() {
604
629
  var player = this.player;
605
- var controls = player.controls;
606
630
  this.thumbnailPlugin = null;
607
631
  this.innerList.destroy();
608
632
  this.innerList = null;
@@ -612,10 +636,6 @@ var Progress = /* @__PURE__ */ function(_Plugin) {
612
636
  this.root.removeEventListener("touchmove", this.onMouseMove);
613
637
  this.root.removeEventListener("touchend", this.onMouseUp);
614
638
  this.root.removeEventListener("touchcancel", this.onMouseUp);
615
- if (controls) {
616
- controls.root && controls.root.removeEventListener("touchmove", util.stopPropagation);
617
- controls.center && controls.center.removeEventListener("touchend", util.stopPropagation);
618
- }
619
639
  }
620
640
  if (domEventType === "mouse" || domEventType === "compatible") {
621
641
  this.unbind("mousedown", this.onMouseDown);
@@ -27,6 +27,8 @@ declare class Time extends Plugin {
27
27
  updateTime(time: any): void;
28
28
  minWidthTime(timeStr: any): any;
29
29
  resetActive(): void;
30
+ __updateState: () => void;
31
+ setActiveState(state: any): void;
30
32
  render(): string;
31
33
  }
32
34
  import Plugin from "../../plugin";
@@ -47,7 +47,7 @@ var Time = /* @__PURE__ */ function(_Plugin) {
47
47
  this.timeDom = this.find(".time-current");
48
48
  this.on([DURATION_CHANGE, SEEKED, TIME_UPDATE], function(e) {
49
49
  if (e.eventName === "durationchange") {
50
- _this2.isActiving = false;
50
+ _this2.setActiveState(false);
51
51
  }
52
52
  _this2.onTimeUpdate();
53
53
  });
@@ -181,16 +181,23 @@ var Time = /* @__PURE__ */ function(_Plugin) {
181
181
  value: function resetActive() {
182
182
  var _this3 = this;
183
183
  var player = this.player;
184
- var updateState = function updateState2() {
185
- _this3.isActiving = false;
186
- };
187
- this.off(SEEKED, updateState);
184
+ if (!this.__updateState) {
185
+ this.__updateState = function() {
186
+ _this3.setActiveState(false);
187
+ };
188
+ }
189
+ this.off(SEEKED, this.__updateState);
188
190
  if (player.isSeeking && player.media.seeking) {
189
- this.once(SEEKED, updateState);
191
+ this.once(SEEKED, this.__updateState);
190
192
  } else {
191
- this.isActiving = false;
193
+ this.setActiveState(false);
192
194
  }
193
195
  }
196
+ }, {
197
+ key: "setActiveState",
198
+ value: function setActiveState(state) {
199
+ this.isActiving = state;
200
+ }
194
201
  }, {
195
202
  key: "destroy",
196
203
  value: function destroy() {
package/es/version.js CHANGED
@@ -1,2 +1,2 @@
1
- var version = "3.0.17-alpha.2";
1
+ var version = "3.0.17-alpha.4";
2
2
  export { version as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xgplayer",
3
- "version": "3.0.17-alpha.2",
3
+ "version": "3.0.17-alpha.4",
4
4
  "description": "video player",
5
5
  "main": "dist/index.min.js",
6
6
  "module": "es/index.js",
@@ -16,7 +16,7 @@
16
16
  "publishConfig": {
17
17
  "registry": "https://registry.npmjs.org/",
18
18
  "access": "public",
19
- "tag": "al"
19
+ "tag": "alpha"
20
20
  },
21
21
  "files": [
22
22
  "dist",