xgplayer 3.0.12-rc.0 → 3.0.13
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 +5 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/es/index.d.ts +2 -1
- package/es/index.js +1 -0
- package/es/index.umd.d.ts +2 -0
- package/es/index.umd.js +2 -0
- package/es/instManager.d.ts +58 -0
- package/es/instManager.js +151 -0
- package/es/lang/br.d.ts +91 -0
- package/es/lang/de.d.ts +91 -0
- package/es/lang/es.d.ts +91 -0
- package/es/lang/fr.d.ts +91 -0
- package/es/lang/id.d.ts +91 -0
- package/es/lang/it.d.ts +91 -0
- package/es/lang/kr.d.ts +91 -0
- package/es/lang/ms-my.d.ts +91 -0
- package/es/lang/ru.d.ts +91 -0
- package/es/lang/th.d.ts +91 -0
- package/es/lang/vn.d.ts +91 -0
- package/es/mediaProxy.d.ts +5 -0
- package/es/player.d.ts +28 -8
- package/es/player.js +45 -23
- package/es/plugin/basePlugin.d.ts +2 -2
- package/es/plugin/plugin.d.ts +6 -7
- package/es/plugin/plugin.js +1 -1
- package/es/plugin/pluginsManager.d.ts +0 -34
- package/es/plugin/pluginsManager.js +1 -49
- package/es/plugins/common/optionsIcon.d.ts +0 -1
- package/es/plugins/common/optionsIcon.js +1 -1
- package/es/plugins/controls/index.d.ts +0 -1
- package/es/plugins/controls/index.js +1 -1
- package/es/plugins/danmu/index.d.ts +1 -0
- package/es/plugins/definition/index.js +1 -1
- package/es/plugins/fpsDetect/index.d.ts +4 -1
- package/es/plugins/fullscreen/index.d.ts +11 -7
- package/es/plugins/fullscreen/index.js +0 -10
- package/es/plugins/heatmap/index.d.ts +4 -2
- package/es/plugins/heatmap/index.js +81 -28
- package/es/plugins/mobile/index.d.ts +6 -5
- package/es/plugins/mobile/touch.d.ts +8 -2
- package/es/plugins/netAdaption/index.d.ts +4 -1
- package/es/plugins/pip/index.d.ts +0 -1
- package/es/plugins/pip/index.js +9 -7
- package/es/plugins/playbackRate/index.js +1 -1
- package/es/plugins/poster/index.d.ts +0 -1
- package/es/plugins/poster/index.js +1 -1
- package/es/plugins/progress/index.d.ts +6 -7
- package/es/plugins/progress/index.js +2 -1
- package/es/plugins/progressPreview/index.d.ts +0 -1
- package/es/plugins/progressPreview/index.js +1 -1
- package/es/plugins/prompt/index.d.ts +5 -2
- package/es/plugins/prompt/index.js +3 -3
- package/es/plugins/replay/index.d.ts +0 -1
- package/es/plugins/replay/index.js +1 -1
- package/es/plugins/start/index.d.ts +0 -1
- package/es/plugins/start/index.js +1 -1
- package/es/plugins/testspeed/index.d.ts +4 -1
- package/es/plugins/time/index.d.ts +1 -2
- package/es/plugins/time/index.js +1 -1
- package/es/plugins/time/timesegments.d.ts +1 -1
- package/es/plugins/track/index.js +1 -1
- package/es/plugins/waitingTimeoutJump/index.d.ts +4 -1
- package/es/presets/default-en.d.ts +1 -2
- package/es/presets/default.d.ts +1 -2
- package/es/presets/mobile.d.ts +1 -2
- package/es/style/common/animation.scss +0 -0
- package/es/style/common/svg-url.scss +0 -0
- package/es/style/index.scss +0 -0
- package/es/style/variable.scss +0 -0
- package/es/utils/util.d.ts +3 -3
- package/es/version.js +1 -1
- package/package.json +3 -3
package/es/player.d.ts
CHANGED
|
@@ -11,15 +11,25 @@ declare class Player extends MediaProxy {
|
|
|
11
11
|
*/
|
|
12
12
|
static set debugger(arg: number);
|
|
13
13
|
static get debugger(): number;
|
|
14
|
+
/**
|
|
15
|
+
* @param {import('./instManager').InstManager} value
|
|
16
|
+
*/
|
|
17
|
+
static set instManager(arg: InstManager);
|
|
18
|
+
/**
|
|
19
|
+
* @param {import('./instManager').InstManager} value
|
|
20
|
+
*/
|
|
21
|
+
static get instManager(): InstManager;
|
|
14
22
|
/**
|
|
15
23
|
* 获取当前处理激活态的实例id
|
|
16
24
|
* @returns { number | string | null }
|
|
25
|
+
* @deprecated 该方法转移到 InstManager 上去使用: player.instManager.getActiveId()
|
|
17
26
|
*/
|
|
18
27
|
static getCurrentUserActivePlayerId(): number | string | null;
|
|
19
28
|
/**
|
|
20
29
|
* 设置实例的用户行为激活状态
|
|
21
30
|
* @param { number | string } playerId
|
|
22
31
|
* @param { boolean } isActive
|
|
32
|
+
* @deprecated 该方法转移到 InstManager 上去使用: player.instManager.setActive()
|
|
23
33
|
*/
|
|
24
34
|
static setCurrentUserActive(playerId: number | string, isActive: boolean): void;
|
|
25
35
|
/**
|
|
@@ -68,6 +78,12 @@ declare class Player extends MediaProxy {
|
|
|
68
78
|
* @private
|
|
69
79
|
*/
|
|
70
80
|
private waitTimer;
|
|
81
|
+
/**
|
|
82
|
+
* @public
|
|
83
|
+
* @description This switch provides the playback plugin with the ability
|
|
84
|
+
* to handle media source by itself.
|
|
85
|
+
*/
|
|
86
|
+
public handleSource: boolean;
|
|
71
87
|
/**
|
|
72
88
|
* @private
|
|
73
89
|
*/
|
|
@@ -96,6 +112,7 @@ declare class Player extends MediaProxy {
|
|
|
96
112
|
private readonly _useAutoplay;
|
|
97
113
|
/**
|
|
98
114
|
* @description 记录起播需要seek的时间点
|
|
115
|
+
* @type { number }
|
|
99
116
|
* @private
|
|
100
117
|
* @readonly
|
|
101
118
|
*/
|
|
@@ -249,6 +266,10 @@ declare class Player extends MediaProxy {
|
|
|
249
266
|
readonly innerStates: {
|
|
250
267
|
isActiveLocked: boolean;
|
|
251
268
|
};
|
|
269
|
+
/**
|
|
270
|
+
* @type {InstManager}
|
|
271
|
+
*/
|
|
272
|
+
instManager: InstManager;
|
|
252
273
|
/**
|
|
253
274
|
* init control domElement
|
|
254
275
|
* @private
|
|
@@ -279,10 +300,10 @@ declare class Player extends MediaProxy {
|
|
|
279
300
|
private _unbindEvents;
|
|
280
301
|
/**
|
|
281
302
|
*
|
|
282
|
-
* @param { any } url
|
|
303
|
+
* @param { any } [url]
|
|
283
304
|
* @returns
|
|
284
305
|
*/
|
|
285
|
-
_startInit(url
|
|
306
|
+
_startInit(url?: any): void;
|
|
286
307
|
set hasStart(arg: boolean);
|
|
287
308
|
/**
|
|
288
309
|
* @type { boolean }
|
|
@@ -378,11 +399,11 @@ declare class Player extends MediaProxy {
|
|
|
378
399
|
removeAttribute(key: string, value: any): void;
|
|
379
400
|
/**
|
|
380
401
|
*
|
|
381
|
-
* @param { any } url
|
|
402
|
+
* @param { any } [url]
|
|
382
403
|
* @returns { Promise<void> | void }
|
|
383
404
|
* @description 启动播放器,start一般都是播放器内部隐式调用,主要功能是将video添加到DOM
|
|
384
405
|
*/
|
|
385
|
-
start(url
|
|
406
|
+
start(url?: any): Promise<void> | void;
|
|
386
407
|
/**
|
|
387
408
|
* @param { string | object } url
|
|
388
409
|
* @param { boolean | {
|
|
@@ -397,7 +418,6 @@ declare class Player extends MediaProxy {
|
|
|
397
418
|
currentTime?: number;
|
|
398
419
|
bitrate?: number;
|
|
399
420
|
}): Promise<any> | null;
|
|
400
|
-
currentTime: any;
|
|
401
421
|
/**
|
|
402
422
|
* @description call play without play hook
|
|
403
423
|
* @deprecated this api renamed to mediaPlay, you can call it as player.mediaPlay()
|
|
@@ -656,7 +676,7 @@ declare class Player extends MediaProxy {
|
|
|
656
676
|
* @param { {[propName: string]: any} } [ext]
|
|
657
677
|
* @returns { url: IUrl, [propName: string]: any }
|
|
658
678
|
*/
|
|
659
|
-
|
|
679
|
+
_preProcessUrl(url: IUrl, ext?: {
|
|
660
680
|
[propName: string]: any;
|
|
661
681
|
}): import("./defaultConfig").IUrl;
|
|
662
682
|
/**
|
|
@@ -737,7 +757,7 @@ declare class Player extends MediaProxy {
|
|
|
737
757
|
get fullscreenChanging(): boolean;
|
|
738
758
|
/**
|
|
739
759
|
* 累计观看时长
|
|
740
|
-
* @type number
|
|
760
|
+
* @type { number }
|
|
741
761
|
*/
|
|
742
762
|
get cumulateTime(): number;
|
|
743
763
|
/**
|
|
@@ -818,7 +838,6 @@ declare class Player extends MediaProxy {
|
|
|
818
838
|
* @param { boolean } [isMuted]
|
|
819
839
|
*/
|
|
820
840
|
setUserActive(isActive: boolean, isMuted?: boolean): void;
|
|
821
|
-
muted: any;
|
|
822
841
|
}
|
|
823
842
|
import Plugin from "./plugin/plugin";
|
|
824
843
|
import BasePlugin from "./plugin/basePlugin";
|
|
@@ -829,4 +848,5 @@ import Util from "./utils/util";
|
|
|
829
848
|
import STATE_CLASS from "./stateClassMap";
|
|
830
849
|
import I18N from "./lang/i18n";
|
|
831
850
|
import MediaProxy from "./mediaProxy";
|
|
851
|
+
import { InstManager } from "./instManager";
|
|
832
852
|
export { Player as default, Plugin, BasePlugin, Events, Errors, Sniffer, Util, STATE_CLASS, I18N };
|
package/es/player.js
CHANGED
|
@@ -27,9 +27,11 @@ import I18N from "./lang/i18n.js";
|
|
|
27
27
|
export { default as I18N } from "./lang/i18n.js";
|
|
28
28
|
import version from "./version.js";
|
|
29
29
|
import { STATES, STATE_ARRAY } from "./state.js";
|
|
30
|
+
import { InstManager, checkPlayerRoot } from "./instManager.js";
|
|
30
31
|
var PlAYER_HOOKS = ["play", "pause", "replay", "retry"];
|
|
31
32
|
var REAL_TIME_SPEED = 0;
|
|
32
33
|
var AVG_SPEED = 0;
|
|
34
|
+
var instManager = null;
|
|
33
35
|
var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
34
36
|
_inherits(Player2, _MediaProxy);
|
|
35
37
|
var _super = _createSuper(Player2);
|
|
@@ -131,6 +133,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
131
133
|
}
|
|
132
134
|
_this.userTimer = null;
|
|
133
135
|
_this.waitTimer = null;
|
|
136
|
+
_this.handleSource = true;
|
|
134
137
|
_this._state = STATES.INITIAL;
|
|
135
138
|
_this.isError = false;
|
|
136
139
|
_this._hasStart = false;
|
|
@@ -192,6 +195,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
192
195
|
_this.innerStates = {
|
|
193
196
|
isActiveLocked: false
|
|
194
197
|
};
|
|
198
|
+
_this.instManager = instManager;
|
|
195
199
|
var rootInit = _this._initDOM();
|
|
196
200
|
if (!rootInit) {
|
|
197
201
|
console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
|
|
@@ -229,7 +233,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
229
233
|
_createClass(Player2, [{
|
|
230
234
|
key: "_initDOM",
|
|
231
235
|
value: function _initDOM() {
|
|
232
|
-
var _this2 = this;
|
|
236
|
+
var _instManager, _this2 = this;
|
|
233
237
|
this.root = this.config.id ? document.getElementById(this.config.id) : null;
|
|
234
238
|
if (!this.root) {
|
|
235
239
|
var el = this.config.el;
|
|
@@ -245,12 +249,13 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
245
249
|
return false;
|
|
246
250
|
}
|
|
247
251
|
}
|
|
248
|
-
var ret =
|
|
252
|
+
var ret = checkPlayerRoot(this.root);
|
|
249
253
|
if (ret) {
|
|
250
254
|
XG_DEBUG.logWarn("The is an Player instance already exists in this.root, destroy it and reinitialize");
|
|
251
255
|
ret.destroy();
|
|
252
256
|
}
|
|
253
257
|
this.root.setAttribute(PLATER_ID, this.playerId);
|
|
258
|
+
(_instManager = instManager) === null || _instManager === void 0 ? void 0 : _instManager.add(this);
|
|
254
259
|
pluginsManager.init(this);
|
|
255
260
|
this._initBaseDoms();
|
|
256
261
|
var XgVideoProxy = this.constructor.XgVideoProxy;
|
|
@@ -372,13 +377,15 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
372
377
|
return;
|
|
373
378
|
}
|
|
374
379
|
}
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
this.media.src
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
if (this.handleSource) {
|
|
381
|
+
this._detachSourceEvents(this.media);
|
|
382
|
+
if (util.typeOf(url) === "Array" && url.length > 0) {
|
|
383
|
+
this._attachSourceEvents(this.media, url);
|
|
384
|
+
} else if (!this.media.src || this.media.src !== url) {
|
|
385
|
+
this.media.src = url;
|
|
386
|
+
} else if (!url) {
|
|
387
|
+
this.media.removeAttribute("src");
|
|
388
|
+
}
|
|
382
389
|
}
|
|
383
390
|
if (util.typeOf(this.config.volume) === "Number") {
|
|
384
391
|
this.volume = this.config.volume;
|
|
@@ -621,7 +628,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
621
628
|
if (!url) {
|
|
622
629
|
url = _this8.url || _this8.config.url;
|
|
623
630
|
}
|
|
624
|
-
var _furl = _this8.
|
|
631
|
+
var _furl = _this8._preProcessUrl(url);
|
|
625
632
|
var ret = _this8._startInit(_furl.url);
|
|
626
633
|
return ret;
|
|
627
634
|
}).catch(function(e) {
|
|
@@ -639,7 +646,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
639
646
|
if (util.typeOf(url) === "Object") {
|
|
640
647
|
_src = url.url;
|
|
641
648
|
}
|
|
642
|
-
_src = this.
|
|
649
|
+
_src = this._preProcessUrl(_src).url;
|
|
643
650
|
var curTime = this.currentTime;
|
|
644
651
|
this.__startTime = curTime;
|
|
645
652
|
var isPaused = this.paused && !this.isError;
|
|
@@ -910,7 +917,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
910
917
|
}, {
|
|
911
918
|
key: "destroy",
|
|
912
919
|
value: function destroy() {
|
|
913
|
-
var _this18 = this;
|
|
920
|
+
var _instManager2, _this18 = this;
|
|
914
921
|
var innerContainer = this.innerContainer, root = this.root, media = this.media;
|
|
915
922
|
if (!root || !media) {
|
|
916
923
|
return;
|
|
@@ -923,6 +930,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
923
930
|
this._detachSourceEvents(this.media);
|
|
924
931
|
util.clearAllTimers(this);
|
|
925
932
|
this.emit(DESTROY);
|
|
933
|
+
(_instManager2 = instManager) === null || _instManager2 === void 0 ? void 0 : _instManager2.remove(this);
|
|
926
934
|
pluginsManager.destroy(this);
|
|
927
935
|
delHooksDescriptor(this);
|
|
928
936
|
_get(_getPrototypeOf(Player2.prototype), "destroy", this).call(this);
|
|
@@ -983,7 +991,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
983
991
|
runHooks(this, "retry", function() {
|
|
984
992
|
var cur = _this20.currentTime;
|
|
985
993
|
var url = _this20.config.url;
|
|
986
|
-
var _srcRet = !util.isMSE(_this20.media) ? _this20.
|
|
994
|
+
var _srcRet = !util.isMSE(_this20.media) ? _this20._preProcessUrl(url) : {
|
|
987
995
|
url
|
|
988
996
|
};
|
|
989
997
|
_this20.src = _srcRet.url;
|
|
@@ -1459,8 +1467,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
1459
1467
|
}, {
|
|
1460
1468
|
key: "resizePosition",
|
|
1461
1469
|
value: function resizePosition() {
|
|
1462
|
-
var _this$videoPos = this.videoPos,
|
|
1463
|
-
|
|
1470
|
+
var _this$videoPos = this.videoPos, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h = _this$videoPos.h, w = _this$videoPos.w;
|
|
1471
|
+
var rotate = this.videoPos.rotate;
|
|
1472
|
+
if (rotate < 0 && h < 0 && w < 0) {
|
|
1464
1473
|
return;
|
|
1465
1474
|
}
|
|
1466
1475
|
var _pi = this.videoPos._pi;
|
|
@@ -1471,13 +1480,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
1471
1480
|
return;
|
|
1472
1481
|
}
|
|
1473
1482
|
this.videoPos.pi = _pi;
|
|
1483
|
+
rotate = rotate < 0 ? 0 : rotate;
|
|
1474
1484
|
var _pos = {
|
|
1475
1485
|
rotate
|
|
1476
1486
|
};
|
|
1477
1487
|
var offsetY = 0;
|
|
1478
1488
|
var offsetX = 0;
|
|
1479
1489
|
var scale = 1;
|
|
1480
|
-
var _t =
|
|
1490
|
+
var _t = Math.abs(rotate / 90);
|
|
1481
1491
|
var root = this.root, innerContainer = this.innerContainer;
|
|
1482
1492
|
var width = root.offsetWidth;
|
|
1483
1493
|
var height = innerContainer ? innerContainer.offsetHeight : root.offsetHeight;
|
|
@@ -1634,10 +1644,10 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
1634
1644
|
this._state = newState;
|
|
1635
1645
|
}
|
|
1636
1646
|
}, {
|
|
1637
|
-
key: "
|
|
1638
|
-
value: function
|
|
1639
|
-
var
|
|
1640
|
-
return !util.isBlob(url) &&
|
|
1647
|
+
key: "_preProcessUrl",
|
|
1648
|
+
value: function _preProcessUrl(url, ext) {
|
|
1649
|
+
var preProcessUrl = this.config.preProcessUrl;
|
|
1650
|
+
return !util.isBlob(url) && typeof preProcessUrl === "function" ? preProcessUrl(url, ext) : {
|
|
1641
1651
|
url
|
|
1642
1652
|
};
|
|
1643
1653
|
}
|
|
@@ -1903,7 +1913,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
1903
1913
|
}
|
|
1904
1914
|
}, {
|
|
1905
1915
|
key: "setUserActive",
|
|
1906
|
-
value: function setUserActive(isActive
|
|
1916
|
+
value: function setUserActive(isActive) {
|
|
1917
|
+
var isMuted = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1907
1918
|
if (typeof isMuted === "boolean" && isMuted !== this.muted) {
|
|
1908
1919
|
this.addInnerOP("volumechange");
|
|
1909
1920
|
this.muted = isMuted;
|
|
@@ -1918,15 +1929,25 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
1918
1929
|
set: function set(value) {
|
|
1919
1930
|
XG_DEBUG.config.debug = value;
|
|
1920
1931
|
}
|
|
1932
|
+
}, {
|
|
1933
|
+
key: "instManager",
|
|
1934
|
+
get: function get() {
|
|
1935
|
+
return instManager;
|
|
1936
|
+
},
|
|
1937
|
+
set: function set(value) {
|
|
1938
|
+
instManager = value;
|
|
1939
|
+
}
|
|
1921
1940
|
}, {
|
|
1922
1941
|
key: "getCurrentUserActivePlayerId",
|
|
1923
1942
|
value: function getCurrentUserActivePlayerId() {
|
|
1924
|
-
|
|
1943
|
+
var _instManager3;
|
|
1944
|
+
return (_instManager3 = instManager) === null || _instManager3 === void 0 ? void 0 : _instManager3.getActiveId();
|
|
1925
1945
|
}
|
|
1926
1946
|
}, {
|
|
1927
1947
|
key: "setCurrentUserActive",
|
|
1928
1948
|
value: function setCurrentUserActive(playerId, isActive) {
|
|
1929
|
-
|
|
1949
|
+
var _instManager4;
|
|
1950
|
+
(_instManager4 = instManager) === null || _instManager4 === void 0 ? void 0 : _instManager4.setActive(playerId, isActive);
|
|
1930
1951
|
}
|
|
1931
1952
|
}, {
|
|
1932
1953
|
key: "isHevcSupported",
|
|
@@ -1961,4 +1982,5 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
1961
1982
|
}(MediaProxy);
|
|
1962
1983
|
_defineProperty(Player, "defaultPreset", null);
|
|
1963
1984
|
_defineProperty(Player, "XgVideoProxy", null);
|
|
1985
|
+
Player.instManager = InstManager.getInstance();
|
|
1964
1986
|
export { Player as default };
|
package/es/plugin/plugin.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type IPluginOptions = {
|
|
|
29
29
|
declare class Plugin extends BasePlugin {
|
|
30
30
|
/**
|
|
31
31
|
* 插入dom结构
|
|
32
|
-
* @param {
|
|
32
|
+
* @param { string | HTMLElement } html html字符串或者dom
|
|
33
33
|
* @param { HTMLElement } parent
|
|
34
34
|
* @param { number } index
|
|
35
35
|
* @returns { HTMLElement }
|
|
@@ -39,8 +39,8 @@ declare class Plugin extends BasePlugin {
|
|
|
39
39
|
/**
|
|
40
40
|
*
|
|
41
41
|
* @param { HTMLElement } root
|
|
42
|
-
* @param {
|
|
43
|
-
* @param {
|
|
42
|
+
* @param { string } querySelector
|
|
43
|
+
* @param { string | Array<string> } eventType
|
|
44
44
|
* @param { Function } callback
|
|
45
45
|
* @param { boolean } [capture=false]
|
|
46
46
|
* @returns
|
|
@@ -70,9 +70,9 @@ declare class Plugin extends BasePlugin {
|
|
|
70
70
|
*/
|
|
71
71
|
private __delegates;
|
|
72
72
|
/**
|
|
73
|
-
* @
|
|
73
|
+
* @protected
|
|
74
74
|
*/
|
|
75
|
-
|
|
75
|
+
protected __init(args: any): void;
|
|
76
76
|
/**
|
|
77
77
|
* @readonly
|
|
78
78
|
*/
|
|
@@ -167,11 +167,10 @@ declare class Plugin extends BasePlugin {
|
|
|
167
167
|
*/
|
|
168
168
|
unbindEL(event: string, eventHandle: Function, isBubble?: boolean): void;
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
171
170
|
* @param { string } [value]
|
|
172
171
|
* @returns
|
|
173
172
|
*/
|
|
174
|
-
show(value?: string):
|
|
173
|
+
show(value?: string): void;
|
|
175
174
|
hide(): void;
|
|
176
175
|
/**
|
|
177
176
|
*
|
package/es/plugin/plugin.js
CHANGED
|
@@ -397,7 +397,7 @@ var Plugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
397
397
|
var cs = window.getComputedStyle(this.root, null);
|
|
398
398
|
var cssDisplayValue = cs.getPropertyValue("display");
|
|
399
399
|
if (cssDisplayValue === "none") {
|
|
400
|
-
|
|
400
|
+
this.root.style.display = "block";
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
}, {
|
|
@@ -3,16 +3,6 @@ declare namespace pluginsManager {
|
|
|
3
3
|
const pluginGroup: {};
|
|
4
4
|
function init(player: any): void;
|
|
5
5
|
function init(player: any): void;
|
|
6
|
-
/**
|
|
7
|
-
* Check whether there is a player instance in the current dom
|
|
8
|
-
* @param {Element} root
|
|
9
|
-
*/
|
|
10
|
-
function checkPlayerRoot(root: Element): any;
|
|
11
|
-
/**
|
|
12
|
-
* Check whether there is a player instance in the current dom
|
|
13
|
-
* @param {Element} root
|
|
14
|
-
*/
|
|
15
|
-
function checkPlayerRoot(root: Element): any;
|
|
16
6
|
function formatPluginInfo(plugin: any, config: any): {
|
|
17
7
|
PLUFGIN: any;
|
|
18
8
|
options: any;
|
|
@@ -133,30 +123,6 @@ declare namespace pluginsManager {
|
|
|
133
123
|
function reRender(player: any): void;
|
|
134
124
|
function onPluginsReady(player: any): void;
|
|
135
125
|
function onPluginsReady(player: any): void;
|
|
136
|
-
/**
|
|
137
|
-
* 设置实例的用户行为激活状态
|
|
138
|
-
* @param { number | string } playerId
|
|
139
|
-
* @param { boolean } isActive
|
|
140
|
-
* @returns { number | null }
|
|
141
|
-
*/
|
|
142
|
-
function setCurrentUserActive(playerId: string | number, isActive: boolean): number;
|
|
143
|
-
/**
|
|
144
|
-
* 设置实例的用户行为激活状态
|
|
145
|
-
* @param { number | string } playerId
|
|
146
|
-
* @param { boolean } isActive
|
|
147
|
-
* @returns { number | null }
|
|
148
|
-
*/
|
|
149
|
-
function setCurrentUserActive(playerId: string | number, isActive: boolean): number;
|
|
150
|
-
/**
|
|
151
|
-
* 获取当前处理激活态的实例id
|
|
152
|
-
* @returns { number | null }
|
|
153
|
-
*/
|
|
154
|
-
function getCurrentUseActiveId(): number;
|
|
155
|
-
/**
|
|
156
|
-
* 获取当前处理激活态的实例id
|
|
157
|
-
* @returns { number | null }
|
|
158
|
-
*/
|
|
159
|
-
function getCurrentUseActiveId(): number;
|
|
160
126
|
function destroy(player: any): void;
|
|
161
127
|
function destroy(player: any): void;
|
|
162
128
|
}
|
|
@@ -11,28 +11,11 @@ var pluginsManager = {
|
|
|
11
11
|
!player.config.closeResizeObserver && addObserver(player.root, function() {
|
|
12
12
|
player.resize();
|
|
13
13
|
});
|
|
14
|
-
if (Object.keys(this.pluginGroup).length === 0) {
|
|
15
|
-
player.isUserActive = true;
|
|
16
|
-
}
|
|
17
14
|
this.pluginGroup[cgid] = {
|
|
18
|
-
_player: player,
|
|
19
15
|
_originalOptions: player.config || {},
|
|
20
16
|
_plugins: {}
|
|
21
17
|
};
|
|
22
18
|
},
|
|
23
|
-
checkPlayerRoot: function checkPlayerRoot(root) {
|
|
24
|
-
if (this.pluginGroup) {
|
|
25
|
-
var _keys = Object.keys(this.pluginGroup);
|
|
26
|
-
for (var i = 0; i < _keys.length; i++) {
|
|
27
|
-
var _p = this.pluginGroup[_keys[i]]._player;
|
|
28
|
-
if (_p.root === root) {
|
|
29
|
-
return _p;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
return null;
|
|
35
|
-
},
|
|
36
19
|
formatPluginInfo: function formatPluginInfo(plugin, config) {
|
|
37
20
|
var PLUFGIN = null;
|
|
38
21
|
var options = null;
|
|
@@ -107,7 +90,7 @@ var pluginsManager = {
|
|
|
107
90
|
}
|
|
108
91
|
var plugins = this.pluginGroup[cgid]._plugins;
|
|
109
92
|
var originalOptions = this.pluginGroup[cgid]._originalOptions;
|
|
110
|
-
options.player =
|
|
93
|
+
options.player = player;
|
|
111
94
|
var pluginName = options.pluginName || plugin.pluginName;
|
|
112
95
|
if (!pluginName) {
|
|
113
96
|
throw new Error("The property pluginName is necessary");
|
|
@@ -306,37 +289,6 @@ var pluginsManager = {
|
|
|
306
289
|
}
|
|
307
290
|
});
|
|
308
291
|
},
|
|
309
|
-
setCurrentUserActive: function setCurrentUserActive(playerId, isActive) {
|
|
310
|
-
if (!this.pluginGroup[playerId]) {
|
|
311
|
-
return;
|
|
312
|
-
}
|
|
313
|
-
if (!isActive) {
|
|
314
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
315
|
-
return playerId;
|
|
316
|
-
}
|
|
317
|
-
var keys = Object.keys(this.pluginGroup);
|
|
318
|
-
for (var i = 0; i < keys.length; i++) {
|
|
319
|
-
var c = this.pluginGroup[keys[i]];
|
|
320
|
-
if (c && c._player) {
|
|
321
|
-
this.pluginGroup[keys[i]]._player.isUserActive = false;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
this.pluginGroup[playerId]._player.isUserActive = isActive;
|
|
325
|
-
return playerId;
|
|
326
|
-
},
|
|
327
|
-
getCurrentUseActiveId: function getCurrentUseActiveId() {
|
|
328
|
-
if (!this.pluginGroup) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
var keys = Object.keys(this.pluginGroup);
|
|
332
|
-
for (var i = 0; i < keys.length; i++) {
|
|
333
|
-
var c = this.pluginGroup[keys[i]];
|
|
334
|
-
if (c && c._player && c._player.isUserActive) {
|
|
335
|
-
return keys[i];
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
return null;
|
|
339
|
-
},
|
|
340
292
|
destroy: function destroy(player) {
|
|
341
293
|
var cgid = player._pluginInfoId;
|
|
342
294
|
if (!this.pluginGroup[cgid]) {
|
|
@@ -13,7 +13,10 @@ export default class FpsDetect extends BasePlugin {
|
|
|
13
13
|
stuckCount: number;
|
|
14
14
|
reportFrame: number;
|
|
15
15
|
};
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @type {null | number}
|
|
18
|
+
*/
|
|
19
|
+
timer: null | number;
|
|
17
20
|
_lastDecodedFrames: any;
|
|
18
21
|
_currentStuckCount: number;
|
|
19
22
|
_lastCheckPoint: number;
|
|
@@ -22,10 +22,16 @@ export default class Fullscreen extends IconPlugin {
|
|
|
22
22
|
* @private
|
|
23
23
|
*/
|
|
24
24
|
private _onOrientationChange;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
registerIcons(): {
|
|
26
|
+
fullscreen: {
|
|
27
|
+
icon: any;
|
|
28
|
+
class: string;
|
|
29
|
+
};
|
|
30
|
+
exitFullscreen: {
|
|
31
|
+
icon: any;
|
|
32
|
+
class: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
29
35
|
initIcons(): void;
|
|
30
36
|
/**
|
|
31
37
|
* 切换全屏
|
|
@@ -37,12 +43,10 @@ export default class Fullscreen extends IconPlugin {
|
|
|
37
43
|
* @param { boolean } isFullScreen
|
|
38
44
|
*/
|
|
39
45
|
animate(isFullScreen: boolean): void;
|
|
40
|
-
show(): void;
|
|
41
46
|
/**
|
|
42
|
-
* @private
|
|
43
47
|
* @returns
|
|
44
48
|
*/
|
|
45
|
-
|
|
49
|
+
render(): string;
|
|
46
50
|
}
|
|
47
51
|
export type IFullscreenConfig = {
|
|
48
52
|
[propName: string]: any;
|
|
@@ -158,16 +158,6 @@ var Fullscreen = /* @__PURE__ */ function(_IconPlugin) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
|
-
}, {
|
|
162
|
-
key: "show",
|
|
163
|
-
value: function show() {
|
|
164
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "show", this).call(this);
|
|
165
|
-
}
|
|
166
|
-
}, {
|
|
167
|
-
key: "hide",
|
|
168
|
-
value: function hide() {
|
|
169
|
-
_get(_getPrototypeOf(Fullscreen2.prototype), "hide", this).call(this);
|
|
170
|
-
}
|
|
171
161
|
}, {
|
|
172
162
|
key: "render",
|
|
173
163
|
value: function render() {
|
|
@@ -30,16 +30,18 @@ export default class HeatMap extends Plugin {
|
|
|
30
30
|
xData: any[];
|
|
31
31
|
yData: any[];
|
|
32
32
|
yMax: number;
|
|
33
|
+
_duration: number;
|
|
33
34
|
curData: any[];
|
|
34
35
|
setConfig(config: any): void;
|
|
36
|
+
reset(): void;
|
|
35
37
|
createRoot(): void;
|
|
36
38
|
root: HTMLElement;
|
|
37
39
|
canvas: HTMLElement;
|
|
38
40
|
resize(): void;
|
|
39
|
-
formatData(data: any): any;
|
|
41
|
+
formatData(data: any, duration: any, minValue: any): any[];
|
|
40
42
|
_getX(index: any, stepX: any, item: any, width: any): number;
|
|
43
|
+
_getY(item: any, stepY: any, maxY: any): any;
|
|
41
44
|
setData(data: any): void;
|
|
42
|
-
xData2: any[];
|
|
43
45
|
_getFillStyle(ctx: any): any;
|
|
44
46
|
drawLinePath(): void;
|
|
45
47
|
clearCanvas(): void;
|