xgplayer 3.0.8 → 3.0.9
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/dist/index.min.css +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/defaultConfig.d.ts +2 -2
- package/es/events.d.ts +1 -0
- package/es/events.js +3 -2
- package/es/index.css +4 -0
- package/es/mediaProxy.d.ts +1 -0
- package/es/mediaProxy.js +7 -4
- package/es/player.d.ts +12 -3
- package/es/player.js +36 -14
- package/es/plugins/controls/index.d.ts +1 -1
- package/es/plugins/controls/index.js +4 -3
- package/es/plugins/keyboard/index.d.ts +23 -3
- package/es/plugins/keyboard/index.js +130 -40
- package/es/plugins/progressPreview/dotsApi.js +48 -4
- package/es/plugins/progressPreview/index.css +15 -0
- package/es/plugins/progressPreview/index.scss +17 -0
- package/es/plugins/time/index.css +10 -0
- package/es/plugins/time/index.d.ts +1 -0
- package/es/plugins/time/index.js +13 -6
- package/es/plugins/time/index.scss +10 -0
- package/es/style/common.scss +6 -0
- package/es/version.js +1 -1
- package/package.json +2 -2
|
@@ -25,38 +25,62 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
25
25
|
}
|
|
26
26
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
27
27
|
_defineProperty(_assertThisInitialized(_this), "onBodyKeyDown", function(event) {
|
|
28
|
-
|
|
29
|
-
if (!_this.player || !_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
28
|
+
if (!_this.player) {
|
|
30
29
|
return;
|
|
31
30
|
}
|
|
32
|
-
|
|
31
|
+
var e = event || window.event;
|
|
32
|
+
var keyCode = e.keyCode;
|
|
33
|
+
var _assertThisInitialize = _assertThisInitialized(_this), _keyState = _assertThisInitialize._keyState;
|
|
34
|
+
if (!event.repeat) {
|
|
35
|
+
if (_keyState.isKeyDown || _this.config.disable || _this.config.disableBodyTrigger || !_this.player.isUserActive && !_this.config.isIgnoreUserActive || !_this.checkIsVisible() || e.metaKey || e.altKey || e.ctrlKey) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
if ((e.target === document.body || _this.config.isGlobalTrigger && !isDisableTag(e.target)) && _this.checkCode(keyCode, true)) {
|
|
39
|
+
_keyState.isBodyKeyDown = true;
|
|
40
|
+
}
|
|
41
|
+
document.addEventListener("keyup", _this.onBodyKeyUp);
|
|
42
|
+
}
|
|
43
|
+
if (!_keyState.isBodyKeyDown) {
|
|
33
44
|
return;
|
|
34
45
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return
|
|
46
|
+
_this.handleKeyDown(e);
|
|
47
|
+
});
|
|
48
|
+
_defineProperty(_assertThisInitialized(_this), "onBodyKeyUp", function(event) {
|
|
49
|
+
if (!_this.player) {
|
|
50
|
+
return;
|
|
40
51
|
}
|
|
41
|
-
|
|
52
|
+
document.removeEventListener("keyup", _this.onBodyKeyUp);
|
|
53
|
+
_this.handleKeyUp(event);
|
|
42
54
|
});
|
|
43
55
|
_defineProperty(_assertThisInitialized(_this), "onKeydown", function(event) {
|
|
44
|
-
|
|
45
|
-
if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
|
|
56
|
+
if (!_this.player) {
|
|
46
57
|
return;
|
|
47
58
|
}
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
var e = event || window.event;
|
|
60
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), _keyState = _assertThisInitialize2._keyState;
|
|
61
|
+
if (!e.repeat) {
|
|
62
|
+
if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
if (!_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
if (e && (e.keyCode === 37 || _this.checkCode(e.keyCode)) && (e.target === _this.player.root || e.target === _this.player.video || e.target === _this.player.controls.el)) {
|
|
69
|
+
_keyState.isKeyDown = true;
|
|
70
|
+
}
|
|
71
|
+
_this.player.root.addEventListener("keyup", _this.onKeyup);
|
|
50
72
|
}
|
|
51
|
-
if (!
|
|
73
|
+
if (!_keyState.isKeyDown) {
|
|
52
74
|
return;
|
|
53
75
|
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
76
|
+
_this.handleKeyDown(e);
|
|
77
|
+
});
|
|
78
|
+
_defineProperty(_assertThisInitialized(_this), "onKeyup", function(event) {
|
|
79
|
+
if (!_this.player) {
|
|
80
|
+
return;
|
|
58
81
|
}
|
|
59
|
-
_this.
|
|
82
|
+
_this.player.root.removeEventListener("keyup", _this.onKeyup);
|
|
83
|
+
_this.handleKeyUp(event);
|
|
60
84
|
});
|
|
61
85
|
return _this;
|
|
62
86
|
}
|
|
@@ -70,7 +94,7 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
70
94
|
if (!_this2.keyCodeMap[key]) {
|
|
71
95
|
_this2.keyCodeMap[key] = extendkeyCodeMap[key];
|
|
72
96
|
} else {
|
|
73
|
-
["keyCode", "action", "disable", "isBodyTarget"].map(function(key1) {
|
|
97
|
+
["keyCode", "action", "disable", "pressAction", "disablePress", "isBodyTarget"].map(function(key1) {
|
|
74
98
|
extendkeyCodeMap[key][key1] && (_this2.keyCodeMap[key][key1] = extendkeyCodeMap[key][key1]);
|
|
75
99
|
});
|
|
76
100
|
}
|
|
@@ -90,37 +114,51 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
90
114
|
keyCode: 32,
|
|
91
115
|
action: "playPause",
|
|
92
116
|
disable: false,
|
|
117
|
+
disablePress: false,
|
|
93
118
|
noBodyTarget: false
|
|
94
119
|
},
|
|
95
120
|
up: {
|
|
96
121
|
keyCode: 38,
|
|
97
122
|
action: "upVolume",
|
|
98
123
|
disable: false,
|
|
124
|
+
disablePress: false,
|
|
99
125
|
noBodyTarget: true
|
|
100
126
|
},
|
|
101
127
|
down: {
|
|
102
128
|
keyCode: 40,
|
|
103
129
|
action: "downVolume",
|
|
104
130
|
disable: false,
|
|
131
|
+
disablePress: false,
|
|
105
132
|
noBodyTarget: true
|
|
106
133
|
},
|
|
107
134
|
left: {
|
|
108
135
|
keyCode: 37,
|
|
109
136
|
action: "seekBack",
|
|
137
|
+
disablePress: false,
|
|
110
138
|
disable: false
|
|
111
139
|
},
|
|
112
140
|
right: {
|
|
113
141
|
keyCode: 39,
|
|
114
142
|
action: "seek",
|
|
143
|
+
pressAction: "changePlaybackRate",
|
|
144
|
+
disablePress: false,
|
|
115
145
|
disable: false
|
|
116
146
|
},
|
|
117
147
|
esc: {
|
|
118
148
|
keyCode: 27,
|
|
119
149
|
action: "exitFullscreen",
|
|
150
|
+
disablePress: true,
|
|
120
151
|
disable: false
|
|
121
152
|
}
|
|
122
153
|
};
|
|
123
154
|
this.mergekeyCodeMap();
|
|
155
|
+
this._keyState = {
|
|
156
|
+
isKeyDown: false,
|
|
157
|
+
isBodyKeyDown: false,
|
|
158
|
+
isPress: false,
|
|
159
|
+
tt: 0,
|
|
160
|
+
playbackRate: 0
|
|
161
|
+
};
|
|
124
162
|
this.player.root.addEventListener("keydown", this.onKeydown);
|
|
125
163
|
document.addEventListener("keydown", this.onBodyKeyDown);
|
|
126
164
|
}
|
|
@@ -154,6 +192,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
154
192
|
key: "downVolume",
|
|
155
193
|
value: function downVolume(event) {
|
|
156
194
|
var player = this.player;
|
|
195
|
+
if (player.volume <= 0) {
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
157
198
|
var val = parseFloat((player.volume - 0.1).toFixed(1));
|
|
158
199
|
var props = {
|
|
159
200
|
volume: {
|
|
@@ -174,6 +215,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
174
215
|
key: "upVolume",
|
|
175
216
|
value: function upVolume(event) {
|
|
176
217
|
var player = this.player;
|
|
218
|
+
if (player.volume >= 1) {
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
177
221
|
var val = parseFloat((player.volume + 0.1).toFixed(1));
|
|
178
222
|
var props = {
|
|
179
223
|
volume: {
|
|
@@ -195,8 +239,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
195
239
|
value: function seek(event) {
|
|
196
240
|
var _this$player = this.player, currentTime = _this$player.currentTime, duration = _this$player.duration;
|
|
197
241
|
var _time = currentTime;
|
|
198
|
-
|
|
199
|
-
|
|
242
|
+
var _step = event.repeat && this.seekStep >= 4 ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
243
|
+
if (currentTime + _step <= duration) {
|
|
244
|
+
_time = currentTime + _step;
|
|
200
245
|
} else {
|
|
201
246
|
_time = duration;
|
|
202
247
|
}
|
|
@@ -215,9 +260,10 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
215
260
|
key: "seekBack",
|
|
216
261
|
value: function seekBack(event) {
|
|
217
262
|
var currentTime = this.player.currentTime;
|
|
263
|
+
var _step = event.repeat ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
218
264
|
var _time = 0;
|
|
219
|
-
if (currentTime -
|
|
220
|
-
_time = currentTime -
|
|
265
|
+
if (currentTime - _step >= 0) {
|
|
266
|
+
_time = currentTime - _step;
|
|
221
267
|
}
|
|
222
268
|
var props = {
|
|
223
269
|
currentTime: {
|
|
@@ -230,6 +276,15 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
230
276
|
});
|
|
231
277
|
this.player.currentTime = _time;
|
|
232
278
|
}
|
|
279
|
+
}, {
|
|
280
|
+
key: "changePlaybackRate",
|
|
281
|
+
value: function changePlaybackRate(event) {
|
|
282
|
+
var _keyState = this._keyState, config = this.config, player = this.player;
|
|
283
|
+
if (_keyState.playbackRate === 0) {
|
|
284
|
+
_keyState.playbackRate = player.playbackRate;
|
|
285
|
+
player.playbackRate = config.playbackRate;
|
|
286
|
+
}
|
|
287
|
+
}
|
|
233
288
|
}, {
|
|
234
289
|
key: "playPause",
|
|
235
290
|
value: function playPause(event) {
|
|
@@ -266,32 +321,66 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
266
321
|
player.exitCssFullscreen();
|
|
267
322
|
}
|
|
268
323
|
}
|
|
324
|
+
}, {
|
|
325
|
+
key: "handleKeyDown",
|
|
326
|
+
value: function handleKeyDown(e) {
|
|
327
|
+
var _keyState = this._keyState;
|
|
328
|
+
if (e.repeat) {
|
|
329
|
+
_keyState.isPress = true;
|
|
330
|
+
var _t = Date.now();
|
|
331
|
+
if (_t - _keyState.tt < 200) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
_keyState.tt = _t;
|
|
335
|
+
}
|
|
336
|
+
preventDefault(e);
|
|
337
|
+
this.handleKeyCode(e.keyCode, e, _keyState.isPress);
|
|
338
|
+
}
|
|
339
|
+
}, {
|
|
340
|
+
key: "handleKeyUp",
|
|
341
|
+
value: function handleKeyUp(e) {
|
|
342
|
+
var _keyState = this._keyState;
|
|
343
|
+
if (_keyState.playbackRate > 0) {
|
|
344
|
+
this.player.playbackRate = _keyState.playbackRate;
|
|
345
|
+
_keyState.playbackRate = 0;
|
|
346
|
+
}
|
|
347
|
+
_keyState.isKeyDown = false;
|
|
348
|
+
_keyState.isPress = false;
|
|
349
|
+
_keyState.tt = 0;
|
|
350
|
+
}
|
|
269
351
|
}, {
|
|
270
352
|
key: "handleKeyCode",
|
|
271
|
-
value: function handleKeyCode(curKeyCode, event) {
|
|
272
|
-
var
|
|
273
|
-
|
|
274
|
-
var
|
|
275
|
-
if (keyCode === curKeyCode
|
|
276
|
-
if (
|
|
277
|
-
action
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
353
|
+
value: function handleKeyCode(curKeyCode, event, isPress) {
|
|
354
|
+
var arr = Object.keys(this.keyCodeMap);
|
|
355
|
+
for (var i = 0; i < arr.length; i++) {
|
|
356
|
+
var _this$keyCodeMap$arr$ = this.keyCodeMap[arr[i]], action = _this$keyCodeMap$arr$.action, keyCode = _this$keyCodeMap$arr$.keyCode, disable = _this$keyCodeMap$arr$.disable, pressAction = _this$keyCodeMap$arr$.pressAction, disablePress = _this$keyCodeMap$arr$.disablePress;
|
|
357
|
+
if (keyCode === curKeyCode) {
|
|
358
|
+
if (!disable && !(isPress && disablePress)) {
|
|
359
|
+
var _action = !isPress ? action : pressAction || action;
|
|
360
|
+
if (typeof _action === "function") {
|
|
361
|
+
action(event, this.player, isPress);
|
|
362
|
+
} else if (typeof _action === "string") {
|
|
363
|
+
if (typeof this[_action] === "function") {
|
|
364
|
+
this[_action](event, this.player, isPress);
|
|
365
|
+
}
|
|
281
366
|
}
|
|
367
|
+
this.emit(SHORTCUT, _objectSpread2({
|
|
368
|
+
key: arr[i],
|
|
369
|
+
target: event.target,
|
|
370
|
+
isPress
|
|
371
|
+
}, this.keyCodeMap[arr[i]]));
|
|
282
372
|
}
|
|
283
|
-
|
|
284
|
-
key,
|
|
285
|
-
target: event.target
|
|
286
|
-
}, _this4.keyCodeMap[key]));
|
|
373
|
+
break;
|
|
287
374
|
}
|
|
288
|
-
}
|
|
375
|
+
}
|
|
289
376
|
}
|
|
290
377
|
}, {
|
|
291
378
|
key: "destroy",
|
|
292
379
|
value: function destroy() {
|
|
293
380
|
this.player.root.removeEventListener("keydown", this.onKeydown);
|
|
294
381
|
document.removeEventListener("keydown", this.onBodyKeyDown);
|
|
382
|
+
this.player.root.removeEventListener("keyup", this.onKeyup);
|
|
383
|
+
document.removeEventListener("keyup", this.onBodyKeyUp);
|
|
295
384
|
}
|
|
296
385
|
}, {
|
|
297
386
|
key: "disable",
|
|
@@ -313,12 +402,13 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
313
402
|
get: function get() {
|
|
314
403
|
return {
|
|
315
404
|
seekStep: 10,
|
|
316
|
-
checkVisible:
|
|
405
|
+
checkVisible: false,
|
|
317
406
|
disableBodyTrigger: false,
|
|
318
407
|
disableRootTrigger: false,
|
|
319
408
|
isGlobalTrigger: false,
|
|
320
409
|
keyCodeMap: {},
|
|
321
410
|
disable: false,
|
|
411
|
+
playbackRate: 2,
|
|
322
412
|
isIgnoreUserActive: false
|
|
323
413
|
};
|
|
324
414
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import util from "../../utils/util.js";
|
|
2
|
-
import { DURATION_CHANGE } from "../../events.js";
|
|
2
|
+
import { DURATION_CHANGE, VIDEO_RESIZE } from "../../events.js";
|
|
3
3
|
import "../../utils/debug.js";
|
|
4
4
|
import "delegate";
|
|
5
5
|
var ISPOT = {
|
|
@@ -65,7 +65,8 @@ var APIS = {
|
|
|
65
65
|
style.width = "".concat(ret.width, "%");
|
|
66
66
|
var className = "xgspot_".concat(iSpot.id, " xgplayer-spot");
|
|
67
67
|
ret.isMini && (className += " mini");
|
|
68
|
-
var
|
|
68
|
+
var _t = iSpot.template ? '<div class="xgplayer-spot-pop">'.concat(iSpot.template, "</div>") : "";
|
|
69
|
+
var dotDom = util.createDom("xg-spot", _t, {
|
|
69
70
|
"data-text": iSpot.text,
|
|
70
71
|
"data-time": iSpot.time,
|
|
71
72
|
"data-id": iSpot.id
|
|
@@ -74,6 +75,7 @@ var APIS = {
|
|
|
74
75
|
dotDom.style[key] = style[key];
|
|
75
76
|
});
|
|
76
77
|
progress.outer && progress.outer.appendChild(dotDom);
|
|
78
|
+
this.positionDot(dotDom, iSpot.id);
|
|
77
79
|
},
|
|
78
80
|
findDot: function findDot(id) {
|
|
79
81
|
if (!this.player.plugins.progress) {
|
|
@@ -175,8 +177,43 @@ var APIS = {
|
|
|
175
177
|
}
|
|
176
178
|
});
|
|
177
179
|
},
|
|
178
|
-
|
|
180
|
+
positionDots: function positionDots() {
|
|
179
181
|
var _this3 = this;
|
|
182
|
+
var _ispots = this._ispots, playerSize = this.playerSize;
|
|
183
|
+
var sizeInfo = this.player.sizeInfo;
|
|
184
|
+
var progress = this.player.plugins.progress;
|
|
185
|
+
if (!progress || sizeInfo.width === playerSize.width) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
playerSize.width = sizeInfo.width;
|
|
189
|
+
playerSize.left = sizeInfo.left;
|
|
190
|
+
_ispots.forEach(function(item) {
|
|
191
|
+
var dotDom = progress.find('xg-spot[data-id="'.concat(item.id, '"]'));
|
|
192
|
+
dotDom && _this3.positionDot(dotDom, item.id);
|
|
193
|
+
});
|
|
194
|
+
},
|
|
195
|
+
positionDot: function positionDot(dotDom, id) {
|
|
196
|
+
var _pop = util.findDom(dotDom, ".xgplayer-spot-pop");
|
|
197
|
+
if (!_pop) {
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
var pRect = this.playerSize;
|
|
201
|
+
var rect1 = dotDom.getBoundingClientRect();
|
|
202
|
+
var rect = _pop.getBoundingClientRect();
|
|
203
|
+
var _left = rect1.left - pRect.left;
|
|
204
|
+
var _diff = pRect.width - _left - rect1.width / 2;
|
|
205
|
+
if (_left < rect.width / 2 || pRect.width < rect.width) {
|
|
206
|
+
var t = rect.width / 2 - _left;
|
|
207
|
+
_pop.style.left = "".concat(t, "px");
|
|
208
|
+
} else if (_diff < rect.width / 2) {
|
|
209
|
+
var _t2 = _diff - rect.width / 2 + rect1.width / 2;
|
|
210
|
+
_pop.style.left = "".concat(_t2, "px");
|
|
211
|
+
} else {
|
|
212
|
+
_pop.style.left = "50%";
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
updateDuration: function updateDuration() {
|
|
216
|
+
var _this4 = this;
|
|
180
217
|
var progress = this.player.plugins.progress;
|
|
181
218
|
if (!progress) {
|
|
182
219
|
return;
|
|
@@ -184,7 +221,7 @@ var APIS = {
|
|
|
184
221
|
var _ispots = this._ispots;
|
|
185
222
|
_ispots.forEach(function(item) {
|
|
186
223
|
var dotDom = progress.find('xg-spot[data-id="'.concat(item.id, '"]'));
|
|
187
|
-
|
|
224
|
+
_this4._updateDotDom(item, dotDom);
|
|
188
225
|
});
|
|
189
226
|
},
|
|
190
227
|
getAllDotsDom: function getAllDotsDom() {
|
|
@@ -214,6 +251,10 @@ function initDotsAPI(plugin) {
|
|
|
214
251
|
return item;
|
|
215
252
|
});
|
|
216
253
|
plugin.ispotsInit = false;
|
|
254
|
+
plugin.playerSize = {
|
|
255
|
+
left: player.sizeInfo.left,
|
|
256
|
+
width: player.sizeInfo.width
|
|
257
|
+
};
|
|
217
258
|
plugin.on(DURATION_CHANGE, function() {
|
|
218
259
|
if (!plugin.ispotsInit) {
|
|
219
260
|
plugin.initDots();
|
|
@@ -221,5 +262,8 @@ function initDotsAPI(plugin) {
|
|
|
221
262
|
plugin.updateDuration();
|
|
222
263
|
}
|
|
223
264
|
});
|
|
265
|
+
plugin.on(VIDEO_RESIZE, function() {
|
|
266
|
+
plugin.positionDots();
|
|
267
|
+
});
|
|
224
268
|
}
|
|
225
269
|
export { initDotsAPI as default };
|
|
@@ -16,6 +16,21 @@
|
|
|
16
16
|
min-width: 6px;
|
|
17
17
|
transform: translate(-50%, 0);
|
|
18
18
|
}
|
|
19
|
+
.xgplayer .xgplayer-spot.active .xgplayer-spot-pop {
|
|
20
|
+
display: block;
|
|
21
|
+
opacity: 1;
|
|
22
|
+
pointer-events: initial;
|
|
23
|
+
}
|
|
24
|
+
.xgplayer .xgplayer-spot-pop {
|
|
25
|
+
display: block;
|
|
26
|
+
opacity: 0;
|
|
27
|
+
pointer-events: none;
|
|
28
|
+
position: absolute;
|
|
29
|
+
left: 50%;
|
|
30
|
+
bottom: 5px;
|
|
31
|
+
padding-bottom: 5px;
|
|
32
|
+
transform: translateX(-50%);
|
|
33
|
+
}
|
|
19
34
|
.xgplayer-mobile .xgplayer-spot {
|
|
20
35
|
height: 3px;
|
|
21
36
|
min-width: 3px;
|
|
@@ -14,6 +14,23 @@ $shortBottom: -4px;
|
|
|
14
14
|
min-width: 6px;
|
|
15
15
|
transform: translate(-50%, 0);
|
|
16
16
|
}
|
|
17
|
+
&.active {
|
|
18
|
+
.xgplayer-spot-pop {
|
|
19
|
+
display: block;
|
|
20
|
+
opacity: 1;
|
|
21
|
+
pointer-events: initial;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.xgplayer-spot-pop {
|
|
26
|
+
display: block;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
pointer-events: none;
|
|
29
|
+
position: absolute;
|
|
30
|
+
left: 50%;
|
|
31
|
+
bottom: 5px;
|
|
32
|
+
padding-bottom: 5px;
|
|
33
|
+
transform: translateX(-50%);
|
|
17
34
|
}
|
|
18
35
|
|
|
19
36
|
@at-root.xgplayer-mobile {
|
|
@@ -12,6 +12,16 @@
|
|
|
12
12
|
line-height: 40px;
|
|
13
13
|
height: 40px;
|
|
14
14
|
}
|
|
15
|
+
.xgplayer .xgplayer-time span .time-min-width {
|
|
16
|
+
text-align: center;
|
|
17
|
+
min-width: 2ch;
|
|
18
|
+
}
|
|
19
|
+
.xgplayer .xgplayer-time span .time-min-width:first-child {
|
|
20
|
+
text-align: right;
|
|
21
|
+
}
|
|
22
|
+
.xgplayer .xgplayer-time span .time-min-width:last-child {
|
|
23
|
+
text-align: left;
|
|
24
|
+
}
|
|
15
25
|
.xgplayer .xgplayer-time .time-duration {
|
|
16
26
|
color: rgba(255, 255, 255, 0.5);
|
|
17
27
|
}
|
package/es/plugins/time/index.js
CHANGED
|
@@ -86,12 +86,12 @@ var Time = /* @__PURE__ */ function(_Plugin) {
|
|
|
86
86
|
var current = player.currentTime + this.timeOffset;
|
|
87
87
|
current = util.adjustTimeByDuration(current, duration, isEnded);
|
|
88
88
|
if (this.mode === "flex") {
|
|
89
|
-
this.centerCurDom.innerHTML = util.format(current);
|
|
89
|
+
this.centerCurDom.innerHTML = this.minWidthTime(util.format(current));
|
|
90
90
|
if (duration !== Infinity && duration > 0) {
|
|
91
91
|
this.centerDurDom.innerHTML = util.format(duration);
|
|
92
92
|
}
|
|
93
93
|
} else {
|
|
94
|
-
this.timeDom.innerHTML = util.format(current);
|
|
94
|
+
this.timeDom.innerHTML = this.minWidthTime(util.format(current));
|
|
95
95
|
if (duration !== Infinity && duration > 0) {
|
|
96
96
|
this.durationDom.innerHTML = util.format(duration);
|
|
97
97
|
}
|
|
@@ -101,10 +101,10 @@ var Time = /* @__PURE__ */ function(_Plugin) {
|
|
|
101
101
|
key: "onReset",
|
|
102
102
|
value: function onReset() {
|
|
103
103
|
if (this.mode === "flex") {
|
|
104
|
-
this.centerCurDom.innerHTML = util.format(0);
|
|
104
|
+
this.centerCurDom.innerHTML = this.minWidthTime(util.format(0));
|
|
105
105
|
this.centerDurDom.innerHTML = util.format(0);
|
|
106
106
|
} else {
|
|
107
|
-
this.timeDom.innerHTML = util.format(0);
|
|
107
|
+
this.timeDom.innerHTML = this.minWidthTime(util.format(0));
|
|
108
108
|
this.durationDom.innerHTML = util.format(0);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
@@ -162,10 +162,17 @@ var Time = /* @__PURE__ */ function(_Plugin) {
|
|
|
162
162
|
return;
|
|
163
163
|
}
|
|
164
164
|
if (this.mode === "flex") {
|
|
165
|
-
this.centerCurDom.innerHTML = util.format(time);
|
|
165
|
+
this.centerCurDom.innerHTML = this.minWidthTime(util.format(time));
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
|
-
this.timeDom.innerHTML = util.format(time);
|
|
168
|
+
this.timeDom.innerHTML = this.minWidthTime(util.format(time));
|
|
169
|
+
}
|
|
170
|
+
}, {
|
|
171
|
+
key: "minWidthTime",
|
|
172
|
+
value: function minWidthTime(timeStr) {
|
|
173
|
+
return timeStr.split(":").map(function(value) {
|
|
174
|
+
return '<span class="time-min-width">'.concat(value, "</span>");
|
|
175
|
+
}).join(":");
|
|
169
176
|
}
|
|
170
177
|
}, {
|
|
171
178
|
key: "resetActive",
|
|
@@ -16,6 +16,16 @@ $timeDurationColor: rgba(255, 255, 255, 0.50);
|
|
|
16
16
|
height: 40px;
|
|
17
17
|
// text-align: center;
|
|
18
18
|
// vertical-align: middle;
|
|
19
|
+
.time-min-width {
|
|
20
|
+
text-align: center;
|
|
21
|
+
min-width: 2ch;
|
|
22
|
+
&:first-child {
|
|
23
|
+
text-align: right;
|
|
24
|
+
}
|
|
25
|
+
&:last-child {
|
|
26
|
+
text-align: left;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
19
29
|
}
|
|
20
30
|
.time-duration {
|
|
21
31
|
color: $timeDurationColor;
|
package/es/style/common.scss
CHANGED
package/es/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var version = "3.0.
|
|
1
|
+
var version = "3.0.9";
|
|
2
2
|
export { version as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xgplayer",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.9",
|
|
4
4
|
"description": "video player",
|
|
5
5
|
"main": "dist/index.min.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"delegate": "^3.2.0",
|
|
44
44
|
"downloadjs": "1.4.7",
|
|
45
45
|
"eventemitter3": "^4.0.7",
|
|
46
|
-
"xgplayer-subtitles": "3.0.
|
|
46
|
+
"xgplayer-subtitles": "3.0.9"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
49
|
"core-js": ">=3.12.1"
|