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.
- package/CHANGELOG.md +11 -1
- package/dist/index.min.css +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/constant.d.ts +0 -4
- package/es/constant.js +4 -1
- package/es/defaultConfig.js +2 -0
- package/es/error.js +2 -2
- package/es/index.d.ts +2 -1
- package/es/index.js +4 -3
- package/es/index.umd.d.ts +60 -1
- package/es/index.umd.js +29 -1
- package/es/lang/i18n.js +4 -4
- package/es/mediaProxy.d.ts +8 -0
- package/es/mediaProxy.js +13 -8
- package/es/player.d.ts +119 -14
- package/es/player.js +669 -163
- package/es/plugin/basePlugin.d.ts +6 -3
- package/es/plugin/basePlugin.js +6 -5
- package/es/plugin/index.d.ts +2 -1
- package/es/plugin/plugin.d.ts +0 -1
- package/es/plugin/plugin.js +11 -11
- package/es/plugin/pluginsManager.d.ts +14 -0
- package/es/plugin/pluginsManager.js +32 -16
- package/es/plugin/resizeObserver.js +1 -1
- package/es/plugins/common/iconPlugin.js +1 -0
- package/es/plugins/common/optionList.js +10 -10
- package/es/plugins/common/optionsIcon.js +13 -9
- package/es/plugins/common/thumbnail.d.ts +0 -1
- package/es/plugins/common/thumbnail.js +3 -24
- package/es/plugins/controls/index.css +132 -0
- package/es/plugins/controls/index.js +189 -0
- package/es/plugins/cssFullScreen/index.js +2 -1
- package/es/plugins/danmu/danmuIcon.js +1 -0
- package/es/plugins/danmu/danmuPanel.js +2 -2
- package/es/plugins/danmu/index.js +4 -4
- package/es/plugins/definition/index.js +2 -2
- package/es/plugins/download/index.js +3 -3
- package/es/plugins/dynamicBg/index.js +5 -5
- package/es/plugins/enter/index.js +2 -2
- package/es/plugins/error/index.js +2 -1
- package/es/plugins/fpsDetect/index.js +2 -1
- package/es/plugins/fullscreen/backicon.js +3 -3
- package/es/plugins/fullscreen/index.js +2 -2
- package/es/plugins/gapJump/index.js +2 -1
- package/es/plugins/heatmap/index.css +25 -0
- package/es/plugins/heatmap/index.d.ts +70 -0
- package/es/plugins/heatmap/index.js +306 -0
- package/es/plugins/heatmap/index.scss +28 -0
- package/es/plugins/keyboard/index.js +3 -3
- package/es/plugins/logger/index.js +11 -11
- package/es/plugins/miniScreen/index.js +6 -6
- package/es/plugins/miniScreen/miniScreenIcon.js +1 -0
- package/es/plugins/mobile/index.js +14 -14
- package/es/plugins/pc/index.js +3 -3
- package/es/plugins/pip/index.d.ts +11 -1
- package/es/plugins/pip/index.js +112 -13
- package/es/plugins/play/index.js +2 -1
- package/es/plugins/playNext/index.js +2 -1
- package/es/plugins/playbackRate/index.js +2 -1
- package/es/plugins/poster/index.css +4 -0
- package/es/plugins/poster/index.js +12 -10
- package/es/plugins/poster/index.scss +4 -0
- package/es/plugins/progress/index.js +35 -33
- package/es/plugins/progress/innerList.js +11 -9
- package/es/plugins/progress/miniProgress.js +1 -0
- package/es/plugins/progressPreview/dotsApi.js +5 -5
- package/es/plugins/progressPreview/index.d.ts +2 -2
- package/es/plugins/progressPreview/index.js +29 -29
- package/es/plugins/prompt/index.js +5 -5
- package/es/plugins/replay/index.js +3 -3
- package/es/plugins/rotate/index.js +2 -2
- package/es/plugins/screenShot/index.d.ts +1 -0
- package/es/plugins/screenShot/index.js +8 -3
- package/es/plugins/start/index.js +13 -13
- package/es/plugins/stats/index.js +1 -1
- package/es/plugins/testspeed/index.js +2 -2
- package/es/plugins/time/index.js +34 -31
- package/es/plugins/time/timesegments.js +7 -7
- package/es/plugins/track/index.js +6 -6
- package/es/plugins/volume/index.js +15 -15
- package/es/plugins/waitingTimeoutJump/index.js +2 -1
- package/es/presets/default-en.d.ts +2 -1
- package/es/presets/default-en.js +6 -4
- package/es/presets/default.d.ts +3 -2
- package/es/presets/default.js +6 -4
- package/es/stateClassMap.d.ts +1 -0
- package/es/stateClassMap.js +1 -0
- package/es/utils/database.js +107 -0
- package/es/utils/util.d.ts +300 -282
- package/es/utils/util.js +352 -145
- package/es/utils/xgplayerTimeRange.d.ts +7 -0
- package/es/utils/xgplayerTimeRange.js +25 -0
- package/es/version.js +1 -1
- package/package.json +3 -10
- package/es/simple.umd.d.ts +0 -2
- package/es/utils/throttle.d.ts +0 -12
- package/es/utils/throttle.js +0 -132
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, defineProperty as _defineProperty, assertThisInitialized as _assertThisInitialized, createClass as _createClass, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
|
+
import sniffer from "../../utils/sniffer.js";
|
|
4
|
+
import { MINI_STATE_CHANGE } from "../../events.js";
|
|
5
|
+
import "../../utils/debug.js";
|
|
6
|
+
import Plugin, { POSITIONS } from "../../plugin/plugin.js";
|
|
7
|
+
import STATE_CLASS from "../../stateClassMap.js";
|
|
8
|
+
var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
9
|
+
_inherits(Controls2, _Plugin);
|
|
10
|
+
var _super = _createSuper(Controls2);
|
|
11
|
+
function Controls2() {
|
|
12
|
+
var _this;
|
|
13
|
+
_classCallCheck(this, Controls2);
|
|
14
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
15
|
+
args[_key] = arguments[_key];
|
|
16
|
+
}
|
|
17
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
|
18
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseEnter", function(e) {
|
|
19
|
+
var _assertThisInitialize = _assertThisInitialized(_this), player = _assertThisInitialize.player, playerConfig = _assertThisInitialize.playerConfig;
|
|
20
|
+
playerConfig.closeControlsBlur && player.focus({
|
|
21
|
+
autoHide: false
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function(e) {
|
|
25
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), player = _assertThisInitialize2.player;
|
|
26
|
+
player.focus();
|
|
27
|
+
});
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
_createClass(Controls2, [{
|
|
31
|
+
key: "beforeCreate",
|
|
32
|
+
value: function beforeCreate(args) {
|
|
33
|
+
if (!args.config.mode && sniffer.device === "mobile") {
|
|
34
|
+
args.config.mode = "flex";
|
|
35
|
+
}
|
|
36
|
+
if (args.player.config.marginControls) {
|
|
37
|
+
args.config.autoHide = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "afterCreate",
|
|
42
|
+
value: function afterCreate() {
|
|
43
|
+
var _this2 = this;
|
|
44
|
+
var _this$config = this.config, disable = _this$config.disable, height = _this$config.height, mode = _this$config.mode;
|
|
45
|
+
if (disable) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
mode === "flex" && this.player.addClass(STATE_CLASS.FLEX_CONTROLS);
|
|
49
|
+
var style = {
|
|
50
|
+
height: "".concat(height, "px")
|
|
51
|
+
};
|
|
52
|
+
Object.keys(style).map(function(key) {
|
|
53
|
+
_this2.root.style[key] = style[key];
|
|
54
|
+
});
|
|
55
|
+
this.left = this.find("xg-left-grid");
|
|
56
|
+
this.center = this.find("xg-center-grid");
|
|
57
|
+
this.right = this.find("xg-right-grid");
|
|
58
|
+
this.innerRoot = this.find("xg-inner-controls");
|
|
59
|
+
this.on(MINI_STATE_CHANGE, function(isMini) {
|
|
60
|
+
isMini ? util.addClass(_this2.root, "mini-controls") : util.removeClass(_this2.root, "mini-controls");
|
|
61
|
+
});
|
|
62
|
+
var isMobileSimulateMode = this.playerConfig.isMobileSimulateMode;
|
|
63
|
+
if (sniffer.device !== "mobile" && isMobileSimulateMode !== "mobile") {
|
|
64
|
+
this.bind("mouseenter", this.onMouseEnter);
|
|
65
|
+
this.bind("mouseleave", this.onMouseLeave);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}, {
|
|
69
|
+
key: "focus",
|
|
70
|
+
value: function focus() {
|
|
71
|
+
this.player.focus({
|
|
72
|
+
autoHide: false
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "focusAwhile",
|
|
77
|
+
value: function focusAwhile() {
|
|
78
|
+
this.player.focus({
|
|
79
|
+
autoHide: true
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
}, {
|
|
83
|
+
key: "blur",
|
|
84
|
+
value: function blur() {
|
|
85
|
+
this.player.blur({
|
|
86
|
+
ignorePaused: true
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "recoverAutoHide",
|
|
91
|
+
value: function recoverAutoHide() {
|
|
92
|
+
this.config.autoHide && util.addClass(this.root, STATE_CLASS.CONTROLS_AUTOHIDE);
|
|
93
|
+
}
|
|
94
|
+
}, {
|
|
95
|
+
key: "pauseAutoHide",
|
|
96
|
+
value: function pauseAutoHide() {
|
|
97
|
+
util.removeClass(this.root, STATE_CLASS.CONTROLS_AUTOHIDE);
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "show",
|
|
101
|
+
value: function show() {
|
|
102
|
+
this.root.style.display = "";
|
|
103
|
+
this.player.focus();
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "hide",
|
|
107
|
+
value: function hide() {
|
|
108
|
+
this.root.style.display = "none";
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "mode",
|
|
112
|
+
get: function get() {
|
|
113
|
+
return this.config.mode;
|
|
114
|
+
}
|
|
115
|
+
}, {
|
|
116
|
+
key: "registerPlugin",
|
|
117
|
+
value: function registerPlugin(plugin) {
|
|
118
|
+
var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
119
|
+
var name = arguments.length > 2 ? arguments[2] : void 0;
|
|
120
|
+
if (!this.root) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
var defaultConfig = plugin.defaultConfig || {};
|
|
124
|
+
if (!options.root) {
|
|
125
|
+
var position = options.position ? options.position : options.config && options.config.position ? options.config.position : defaultConfig.position;
|
|
126
|
+
switch (position) {
|
|
127
|
+
case POSITIONS.CONTROLS_LEFT:
|
|
128
|
+
options.root = this.left;
|
|
129
|
+
break;
|
|
130
|
+
case POSITIONS.CONTROLS_RIGHT:
|
|
131
|
+
options.root = this.right;
|
|
132
|
+
break;
|
|
133
|
+
case POSITIONS.CONTROLS_CENTER:
|
|
134
|
+
options.root = this.center;
|
|
135
|
+
break;
|
|
136
|
+
case POSITIONS.CONTROLS:
|
|
137
|
+
options.root = this.root;
|
|
138
|
+
break;
|
|
139
|
+
default:
|
|
140
|
+
options.root = this.left;
|
|
141
|
+
}
|
|
142
|
+
return _get(_getPrototypeOf(Controls2.prototype), "registerPlugin", this).call(this, plugin, options, name);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}, {
|
|
146
|
+
key: "destroy",
|
|
147
|
+
value: function destroy() {
|
|
148
|
+
if (sniffer.device !== "mobile") {
|
|
149
|
+
this.unbind("mouseenter", this.onMouseEnter);
|
|
150
|
+
this.unbind("mouseleave", this.onMouseLeave);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}, {
|
|
154
|
+
key: "render",
|
|
155
|
+
value: function render() {
|
|
156
|
+
var _this$config2 = this.config, mode = _this$config2.mode, autoHide = _this$config2.autoHide, initShow = _this$config2.initShow, disable = _this$config2.disable;
|
|
157
|
+
if (disable) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
var className = util.classNames({
|
|
161
|
+
"xgplayer-controls": true
|
|
162
|
+
}, {
|
|
163
|
+
"flex-controls": mode === "flex"
|
|
164
|
+
}, {
|
|
165
|
+
"bottom-controls": mode === "bottom"
|
|
166
|
+
}, _defineProperty({}, STATE_CLASS.CONTROLS_AUTOHIDE, autoHide), {
|
|
167
|
+
"xgplayer-controls-initshow": initShow || !autoHide
|
|
168
|
+
});
|
|
169
|
+
return '<xg-controls class="'.concat(className, '" unselectable="on">\n <xg-inner-controls class="xg-inner-controls xg-pos">\n <xg-left-grid class="xg-left-grid">\n </xg-left-grid>\n <xg-center-grid class="xg-center-grid"></xg-center-grid>\n <xg-right-grid class="xg-right-grid">\n </xg-right-grid>\n </xg-inner-controls>\n </xg-controls>');
|
|
170
|
+
}
|
|
171
|
+
}], [{
|
|
172
|
+
key: "pluginName",
|
|
173
|
+
get: function get() {
|
|
174
|
+
return "controls";
|
|
175
|
+
}
|
|
176
|
+
}, {
|
|
177
|
+
key: "defaultConfig",
|
|
178
|
+
get: function get() {
|
|
179
|
+
return {
|
|
180
|
+
disable: false,
|
|
181
|
+
autoHide: true,
|
|
182
|
+
mode: "",
|
|
183
|
+
initShow: false
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
}]);
|
|
187
|
+
return Controls2;
|
|
188
|
+
}(Plugin);
|
|
189
|
+
export { Controls as default };
|
|
@@ -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/
|
|
2
|
+
import "../../utils/util.js";
|
|
3
3
|
import { CSS_FULLSCREEN_CHANGE } from "../../events.js";
|
|
4
|
+
import "../../utils/debug.js";
|
|
4
5
|
import { POSITIONS } from "../../plugin/plugin.js";
|
|
5
6
|
import { xgIconTips } from "../common/iconTools.js";
|
|
6
7
|
import Icon from "../common/iconPlugin.js";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, createClass as _createClass, classCallCheck as _classCallCheck } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
+
import "../../utils/util.js";
|
|
2
3
|
import "../../utils/debug.js";
|
|
3
4
|
import Plugin, { POSITIONS } from "../../plugin/plugin.js";
|
|
4
5
|
import { xgIconTips } from "../common/iconTools.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, 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 { hasClass, removeClass, addClass } from "../../utils/util.js";
|
|
4
4
|
import "../../utils/debug.js";
|
|
5
5
|
import Plugin, { POSITIONS } from "../../plugin/plugin.js";
|
|
6
6
|
import PanelIcon from "../assets/panel.js";
|
|
@@ -43,7 +43,7 @@ var DanmuPanel = /* @__PURE__ */ function(_Plugin) {
|
|
|
43
43
|
value: function onToggle(e) {
|
|
44
44
|
e.preventDefault();
|
|
45
45
|
e.stopPropagation();
|
|
46
|
-
hasClass(this.root, "slider-show") ? removeClass(this.root, "slider-show") : addClass(this.root, "slider-show");
|
|
46
|
+
util.hasClass(this.root, "slider-show") ? util.removeClass(this.root, "slider-show") : util.addClass(this.root, "slider-show");
|
|
47
47
|
}
|
|
48
48
|
}, {
|
|
49
49
|
key: "destroy",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, createClass as _createClass, classCallCheck as _classCallCheck } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
2
|
import DanmuJs from "danmu.js";
|
|
3
|
-
import
|
|
3
|
+
import util from "../../utils/util.js";
|
|
4
4
|
import { TIME_UPDATE, PAUSE, PLAY, SEEKING, VIDEO_RESIZE, SEEKED } from "../../events.js";
|
|
5
5
|
import "../../utils/debug.js";
|
|
6
6
|
import Plugin from "../../plugin/plugin.js";
|
|
@@ -54,14 +54,14 @@ var Danmu = /* @__PURE__ */ function(_Plugin) {
|
|
|
54
54
|
return;
|
|
55
55
|
}
|
|
56
56
|
if (_this2.intervalId) {
|
|
57
|
-
clearTimeout(_this2, _this2.intervalId);
|
|
57
|
+
util.clearTimeout(_this2, _this2.intervalId);
|
|
58
58
|
_this2.intervalId = null;
|
|
59
59
|
}
|
|
60
60
|
var now = window.performance.now();
|
|
61
61
|
if (now - _this2.seekCost > MIN_INTERVAL) {
|
|
62
62
|
_this2.danmujs.start();
|
|
63
63
|
} else {
|
|
64
|
-
_this2.intervalId = setTimeout(_this2, function() {
|
|
64
|
+
_this2.intervalId = util.setTimeout(_this2, function() {
|
|
65
65
|
_this2.danmujs.start();
|
|
66
66
|
_this2.intervalId = null;
|
|
67
67
|
}, MIN_INTERVAL);
|
|
@@ -164,7 +164,7 @@ var Danmu = /* @__PURE__ */ function(_Plugin) {
|
|
|
164
164
|
this.isUseClose = false;
|
|
165
165
|
this.show();
|
|
166
166
|
this.resize();
|
|
167
|
-
setTimeout(this, function() {
|
|
167
|
+
util.setTimeout(this, function() {
|
|
168
168
|
_this4.danmujs.start();
|
|
169
169
|
if (_this4.player.paused) {
|
|
170
170
|
_this4.danmujs.pause();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass, objectSpread2 as _objectSpread2, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
-
import
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
3
|
import { DEFINITION_CHANGE } from "../../events.js";
|
|
4
4
|
import "../../utils/debug.js";
|
|
5
5
|
import { POSITIONS } from "../../plugin/plugin.js";
|
|
@@ -52,7 +52,7 @@ var DefinitionIcon = /* @__PURE__ */ function(_OptionsIcon) {
|
|
|
52
52
|
if (!this.config.list || this.config.list.length < 2) {
|
|
53
53
|
return;
|
|
54
54
|
}
|
|
55
|
-
addClass(this.root, "show");
|
|
55
|
+
util.addClass(this.root, "show");
|
|
56
56
|
}
|
|
57
57
|
}, {
|
|
58
58
|
key: "initDefinition",
|
|
@@ -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, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
2
|
import downloadUtil from "downloadjs";
|
|
3
|
-
import
|
|
3
|
+
import util from "../../utils/util.js";
|
|
4
4
|
import "../../utils/debug.js";
|
|
5
5
|
import { POSITIONS } from "../../plugin/plugin.js";
|
|
6
6
|
import { xgIconTips } from "../common/iconTools.js";
|
|
@@ -20,9 +20,9 @@ var Download = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
20
20
|
_this.emitUserAction(e, "download");
|
|
21
21
|
var url = _this.playerConfig.url;
|
|
22
22
|
var dUrl = "";
|
|
23
|
-
if (typeOf(url) === "String") {
|
|
23
|
+
if (util.typeOf(url) === "String") {
|
|
24
24
|
dUrl = url;
|
|
25
|
-
} else if (typeOf(url) === "Array" && url.length > 0) {
|
|
25
|
+
} else if (util.typeOf(url) === "Array" && url.length > 0) {
|
|
26
26
|
dUrl = url[0].src;
|
|
27
27
|
}
|
|
28
28
|
var newUrl = _this.getAbsoluteURL(dUrl);
|
|
@@ -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 { setTimeout, requestAnimationFrame, clearTimeout, cancelAnimationFrame, isMSE, typeOf } from "../../utils/util.js";
|
|
4
4
|
import { TIME_UPDATE, COMPLETE, EMPTIED, PLAY, PAUSE, LOADED_DATA, LOAD_START } from "../../events.js";
|
|
5
5
|
import XG_DEBUG from "../../utils/debug.js";
|
|
6
6
|
import Plugin from "../../plugin/plugin.js";
|
|
@@ -88,11 +88,11 @@ var DynamicBg = /* @__PURE__ */ function(_Plugin) {
|
|
|
88
88
|
_this.preTime = _now;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
_this.frameId = _this._loopType === "timer" ? setTimeout(_assertThisInitialized(_this), _this.start, interval) : requestAnimationFrame(_this.start);
|
|
91
|
+
_this.frameId = _this._loopType === "timer" ? util.setTimeout(_assertThisInitialized(_this), _this.start, interval) : util.requestAnimationFrame(_this.start);
|
|
92
92
|
});
|
|
93
93
|
_defineProperty(_assertThisInitialized(_this), "stop", function() {
|
|
94
94
|
if (_this.frameId) {
|
|
95
|
-
_this._loopType === "timer" ? clearTimeout(_assertThisInitialized(_this), _this.frameId) : cancelAnimationFrame(_this.frameId);
|
|
95
|
+
_this._loopType === "timer" ? util.clearTimeout(_assertThisInitialized(_this), _this.frameId) : util.cancelAnimationFrame(_this.frameId);
|
|
96
96
|
_this.frameId = null;
|
|
97
97
|
}
|
|
98
98
|
});
|
|
@@ -229,7 +229,7 @@ var DynamicBg = /* @__PURE__ */ function(_Plugin) {
|
|
|
229
229
|
return null;
|
|
230
230
|
}
|
|
231
231
|
var _tVideo = video && video instanceof window.HTMLVideoElement ? video : video.canvas ? video.canvas : video.flyVideo ? video.flyVideo : null;
|
|
232
|
-
if (_tVideo && !(sniffer.browser === "safari" && isMSE(_tVideo))) {
|
|
232
|
+
if (_tVideo && !(sniffer.browser === "safari" && util.isMSE(_tVideo))) {
|
|
233
233
|
return _tVideo;
|
|
234
234
|
}
|
|
235
235
|
var _tagName = _tVideo ? _tVideo.tagName.toLowerCase() : "";
|
|
@@ -243,7 +243,7 @@ var DynamicBg = /* @__PURE__ */ function(_Plugin) {
|
|
|
243
243
|
value: function renderByPoster() {
|
|
244
244
|
var poster = this.playerConfig.poster;
|
|
245
245
|
if (poster) {
|
|
246
|
-
var url = typeOf(poster) === "String" ? poster : typeOf(poster.poster) === "String" ? poster.poster : null;
|
|
246
|
+
var url = util.typeOf(poster) === "String" ? poster : util.typeOf(poster.poster) === "String" ? poster.poster : null;
|
|
247
247
|
this.updateImg(url);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
@@ -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
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
3
|
import "../../utils/debug.js";
|
|
4
4
|
import Plugin from "../../plugin/plugin.js";
|
|
5
5
|
var Enter = /* @__PURE__ */ function(_Plugin) {
|
|
@@ -13,7 +13,7 @@ var Enter = /* @__PURE__ */ function(_Plugin) {
|
|
|
13
13
|
key: "render",
|
|
14
14
|
value: function render() {
|
|
15
15
|
var innerHtml = this.config.innerHtml;
|
|
16
|
-
var root = createDom("xg-enter", "", {}, "xgplayer-enter");
|
|
16
|
+
var root = util.createDom("xg-enter", "", {}, "xgplayer-enter");
|
|
17
17
|
if (innerHtml && innerHtml instanceof window.HTMLElement) {
|
|
18
18
|
root.appendChild(innerHtml);
|
|
19
19
|
} else if (innerHtml && typeof innerHtml === "string") {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
-
import "../../utils/
|
|
2
|
+
import "../../utils/util.js";
|
|
3
3
|
import { ERROR } from "../../events.js";
|
|
4
|
+
import "../../utils/debug.js";
|
|
4
5
|
import Plugin from "../../plugin/plugin.js";
|
|
5
6
|
var ErrorPlugin = /* @__PURE__ */ function(_Plugin) {
|
|
6
7
|
_inherits(ErrorPlugin2, _Plugin);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { inherits as _inherits, createSuper as _createSuper, classCallCheck as _classCallCheck, createClass as _createClass } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
-
import "../../utils/
|
|
2
|
+
import "../../utils/util.js";
|
|
3
3
|
import { PLAY, PAUSE, ENDED, EMPTIED, FPS_STUCK } from "../../events.js";
|
|
4
|
+
import "../../utils/debug.js";
|
|
4
5
|
import Plugin from "../../plugin/plugin.js";
|
|
5
6
|
var FpsDetect = /* @__PURE__ */ function(_BasePlugin) {
|
|
6
7
|
_inherits(FpsDetect2, _BasePlugin);
|
|
@@ -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
|
|
2
|
+
import util from "../../utils/util.js";
|
|
3
3
|
import "../../utils/debug.js";
|
|
4
4
|
import Plugin, { POSITIONS } from "../../plugin/plugin.js";
|
|
5
5
|
import BackSVG from "../assets/back.js";
|
|
@@ -41,12 +41,12 @@ var TopBackIcon = /* @__PURE__ */ function(_Plugin) {
|
|
|
41
41
|
}, {
|
|
42
42
|
key: "show",
|
|
43
43
|
value: function show() {
|
|
44
|
-
addClass(this.root, "show");
|
|
44
|
+
util.addClass(this.root, "show");
|
|
45
45
|
}
|
|
46
46
|
}, {
|
|
47
47
|
key: "hide",
|
|
48
48
|
value: function hide() {
|
|
49
|
-
removeClass(this.root, "show");
|
|
49
|
+
util.removeClass(this.root, "show");
|
|
50
50
|
}
|
|
51
51
|
}, {
|
|
52
52
|
key: "render",
|
|
@@ -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, get as _get, getPrototypeOf as _getPrototypeOf } from "../../_virtual/_rollupPluginBabelHelpers.js";
|
|
2
|
+
import util from "../../utils/util.js";
|
|
2
3
|
import sniffer from "../../utils/sniffer.js";
|
|
3
|
-
import { getFullScreenEl } from "../../utils/util.js";
|
|
4
4
|
import { FULLSCREEN_CHANGE } from "../../events.js";
|
|
5
5
|
import "../../utils/debug.js";
|
|
6
6
|
import { POSITIONS } from "../../plugin/plugin.js";
|
|
@@ -42,7 +42,7 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
42
42
|
if (config.target) {
|
|
43
43
|
this.playerConfig.fullscreenTarget = this.config.target;
|
|
44
44
|
}
|
|
45
|
-
var fullEl = getFullScreenEl();
|
|
45
|
+
var fullEl = util.getFullScreenEl();
|
|
46
46
|
if (playerConfig.fullscreenTarget === fullEl) {
|
|
47
47
|
this.player.getFullscreen().catch(function(e) {
|
|
48
48
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
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/
|
|
2
|
+
import "../../utils/util.js";
|
|
3
3
|
import { WAITING, PLAY, SEEKING } from "../../events.js";
|
|
4
|
+
import "../../utils/debug.js";
|
|
4
5
|
import Plugin from "../../plugin/plugin.js";
|
|
5
6
|
var GapJump = /* @__PURE__ */ function(_BasePlugin) {
|
|
6
7
|
_inherits(GapJump2, _BasePlugin);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
.xg-heatmap {
|
|
2
|
+
position: absolute;
|
|
3
|
+
height: 40px;
|
|
4
|
+
width: 100%;
|
|
5
|
+
left: 50%;
|
|
6
|
+
transform: translateX(-50%);
|
|
7
|
+
bottom: 10px;
|
|
8
|
+
opacity: 0;
|
|
9
|
+
transition: opacity 0.2s;
|
|
10
|
+
pointer-events: none;
|
|
11
|
+
}
|
|
12
|
+
.xg-heatmap .xg-heatmap-canvas {
|
|
13
|
+
height: 100%;
|
|
14
|
+
width: 100%;
|
|
15
|
+
}
|
|
16
|
+
.xg-heatmap.xg-heatmap-active-show {
|
|
17
|
+
opacity: 0;
|
|
18
|
+
}
|
|
19
|
+
.xg-heatmap.xg-heatmap-normal {
|
|
20
|
+
opacity: 1;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.xgplayer-progress.active .xg-heatmap-active-show {
|
|
24
|
+
opacity: 1;
|
|
25
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {{
|
|
3
|
+
* lineWidth?: number,
|
|
4
|
+
* dpi?: number,
|
|
5
|
+
* alpha?: number,
|
|
6
|
+
* gradient?: Array<number>,
|
|
7
|
+
* gradientColors?: Array<{ start: number, color:number }>,
|
|
8
|
+
* strokeStyle?: string,
|
|
9
|
+
* fillColor?: string,
|
|
10
|
+
* height?: number,
|
|
11
|
+
* data?: Array<number>,
|
|
12
|
+
* maxValue?: number,
|
|
13
|
+
* minValue?: number,
|
|
14
|
+
* maxLength?: number,
|
|
15
|
+
* mode?: string,
|
|
16
|
+
* [propName: string]: any
|
|
17
|
+
* }} IHeatMapConfig
|
|
18
|
+
*/
|
|
19
|
+
export default class HeatMap extends Plugin {
|
|
20
|
+
/**
|
|
21
|
+
* @type IHeatMapConfig
|
|
22
|
+
*/
|
|
23
|
+
static get defaultConfig(): IHeatMapConfig;
|
|
24
|
+
constructor(args: any);
|
|
25
|
+
canvasHeight: number;
|
|
26
|
+
canvasWidth: number;
|
|
27
|
+
width: number;
|
|
28
|
+
height: number;
|
|
29
|
+
dataFloatLen: number;
|
|
30
|
+
xData: any[];
|
|
31
|
+
yData: any[];
|
|
32
|
+
yMax: number;
|
|
33
|
+
_duration: number;
|
|
34
|
+
curData: any[];
|
|
35
|
+
setConfig(config: any): void;
|
|
36
|
+
reset(): void;
|
|
37
|
+
createRoot(): void;
|
|
38
|
+
root: HTMLElement;
|
|
39
|
+
canvas: HTMLElement;
|
|
40
|
+
resize(): void;
|
|
41
|
+
formatData(data: any, duration: any, minValue: any): any[];
|
|
42
|
+
_getX(index: any, stepX: any, item: any, width: any): number;
|
|
43
|
+
_getY(item: any, stepY: any, maxY: any): any;
|
|
44
|
+
setData(data: any): void;
|
|
45
|
+
_getFillStyle(ctx: any): any;
|
|
46
|
+
drawLinePath(): void;
|
|
47
|
+
clearCanvas(): void;
|
|
48
|
+
fixFloat(_num: any, _length: any): number;
|
|
49
|
+
render(): string;
|
|
50
|
+
}
|
|
51
|
+
export type IHeatMapConfig = {
|
|
52
|
+
[propName: string]: any;
|
|
53
|
+
lineWidth?: number;
|
|
54
|
+
dpi?: number;
|
|
55
|
+
alpha?: number;
|
|
56
|
+
gradient?: Array<number>;
|
|
57
|
+
gradientColors?: Array<{
|
|
58
|
+
start: number;
|
|
59
|
+
color: number;
|
|
60
|
+
}>;
|
|
61
|
+
strokeStyle?: string;
|
|
62
|
+
fillColor?: string;
|
|
63
|
+
height?: number;
|
|
64
|
+
data?: Array<number>;
|
|
65
|
+
maxValue?: number;
|
|
66
|
+
minValue?: number;
|
|
67
|
+
maxLength?: number;
|
|
68
|
+
mode?: string;
|
|
69
|
+
};
|
|
70
|
+
import Plugin from "../../plugin";
|