@volcengine/veplayer 2.0.0-rc.1 → 2.1.0-rc.0
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/README.md +14 -1
- package/esm/index.d.ts +2055 -285
- package/esm/veplayer.biz.live.development.js +206 -46
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +4468 -791
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +884 -288
- package/esm/veplayer.live.d.ts +4534 -858
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +884 -288
- package/esm/veplayer.live.production.css +1 -1
- package/esm/veplayer.live.production.js +4 -4
- package/esm/veplayer.production.css +1 -1
- package/esm/veplayer.production.js +4 -4
- package/esm/veplayer.vod.d.ts +2055 -285
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +653 -213
- package/esm/veplayer.vod.production.css +1 -1
- package/esm/veplayer.vod.production.js +4 -4
- package/package.json +2 -1
- package/umd/index.d.ts +2055 -285
- package/umd/veplayer.biz.live.development.js +206 -46
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +4468 -791
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +884 -288
- package/umd/veplayer.live.d.ts +4534 -858
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +882 -286
- package/umd/veplayer.live.production.css +1 -1
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.css +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +2055 -285
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +653 -213
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
|
@@ -4,6 +4,16 @@ var __publicField = (obj, key, value) => {
|
|
|
4
4
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
return value;
|
|
6
6
|
};
|
|
7
|
+
var Codec = /* @__PURE__ */ ((Codec2) => {
|
|
8
|
+
Codec2["H265"] = "h265";
|
|
9
|
+
Codec2["H264"] = "h264";
|
|
10
|
+
return Codec2;
|
|
11
|
+
})(Codec || {});
|
|
12
|
+
var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
|
|
13
|
+
DecodeType2["Software"] = "software";
|
|
14
|
+
DecodeType2["Hardware"] = "hardware";
|
|
15
|
+
return DecodeType2;
|
|
16
|
+
})(DecodeType || {});
|
|
7
17
|
function ownKeys(object, enumerableOnly) {
|
|
8
18
|
var keys = Object.keys(object);
|
|
9
19
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1000,6 +1010,9 @@ util.isMSE = function(video) {
|
|
|
1000
1010
|
}
|
|
1001
1011
|
return /^blob/.test(video.currentSrc) || /^blob/.test(video.src);
|
|
1002
1012
|
};
|
|
1013
|
+
util.isBlob = function(url) {
|
|
1014
|
+
return /^blob/.test(url);
|
|
1015
|
+
};
|
|
1003
1016
|
util.generateSessionId = function() {
|
|
1004
1017
|
var did = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
1005
1018
|
var d = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -1060,6 +1073,69 @@ util.convertDeg = function(val) {
|
|
|
1060
1073
|
}
|
|
1061
1074
|
return val % 360;
|
|
1062
1075
|
};
|
|
1076
|
+
util.getIndexByTime = function(time, segments) {
|
|
1077
|
+
var _len = segments.length;
|
|
1078
|
+
var _index = -1;
|
|
1079
|
+
if (_len < 1) {
|
|
1080
|
+
return _index;
|
|
1081
|
+
}
|
|
1082
|
+
if (time <= segments[0].end || _len < 2) {
|
|
1083
|
+
_index = 0;
|
|
1084
|
+
} else if (time > segments[_len - 1].end) {
|
|
1085
|
+
_index = _len - 1;
|
|
1086
|
+
} else {
|
|
1087
|
+
for (var i = 1; i < _len; i++) {
|
|
1088
|
+
if (time > segments[i - 1].end && time <= segments[i].end) {
|
|
1089
|
+
_index = i;
|
|
1090
|
+
break;
|
|
1091
|
+
}
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return _index;
|
|
1095
|
+
};
|
|
1096
|
+
util.getOffsetCurrentTime = function(currentTime, segments) {
|
|
1097
|
+
var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1;
|
|
1098
|
+
var _index = -1;
|
|
1099
|
+
if (index >= 0 && index < segments.length) {
|
|
1100
|
+
_index = index;
|
|
1101
|
+
} else {
|
|
1102
|
+
_index = util.getIndexByTime(currentTime, segments);
|
|
1103
|
+
}
|
|
1104
|
+
if (_index < 0) {
|
|
1105
|
+
return -1;
|
|
1106
|
+
}
|
|
1107
|
+
var _len = segments.length;
|
|
1108
|
+
var _segments$_index = segments[_index], start = _segments$_index.start, end = _segments$_index.end, cTime = _segments$_index.cTime, offset = _segments$_index.offset;
|
|
1109
|
+
if (currentTime < start) {
|
|
1110
|
+
return cTime;
|
|
1111
|
+
} else if (currentTime >= start && currentTime <= end) {
|
|
1112
|
+
return currentTime - offset;
|
|
1113
|
+
} else if (currentTime > end && _index >= _len - 1) {
|
|
1114
|
+
return end;
|
|
1115
|
+
}
|
|
1116
|
+
return -1;
|
|
1117
|
+
};
|
|
1118
|
+
util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
1119
|
+
var _index = -1;
|
|
1120
|
+
if (!segments || segments.length < 0) {
|
|
1121
|
+
return offsetTime;
|
|
1122
|
+
}
|
|
1123
|
+
for (var i = 0; i < segments.length; i++) {
|
|
1124
|
+
if (offsetTime <= segments[i].duration) {
|
|
1125
|
+
_index = i;
|
|
1126
|
+
break;
|
|
1127
|
+
}
|
|
1128
|
+
}
|
|
1129
|
+
if (_index !== -1) {
|
|
1130
|
+
var start = segments[_index].start;
|
|
1131
|
+
if (_index - 1 < 0) {
|
|
1132
|
+
return start + offsetTime;
|
|
1133
|
+
} else {
|
|
1134
|
+
return start + (offsetTime - segments[_index - 1].duration);
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
return offsetTime;
|
|
1138
|
+
};
|
|
1063
1139
|
function isObject(value) {
|
|
1064
1140
|
var type = _typeof(value);
|
|
1065
1141
|
return value !== null && (type === "object" || type === "function");
|
|
@@ -1149,7 +1225,7 @@ function debounce(func, wait, options) {
|
|
|
1149
1225
|
function debounced() {
|
|
1150
1226
|
var time = Date.now();
|
|
1151
1227
|
var isInvoking = shouldInvoke(time);
|
|
1152
|
-
for (var
|
|
1228
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
|
|
1153
1229
|
args[_key] = arguments[_key];
|
|
1154
1230
|
}
|
|
1155
1231
|
lastArgs = args;
|
|
@@ -1356,7 +1432,7 @@ var sniffer = {
|
|
|
1356
1432
|
}
|
|
1357
1433
|
}
|
|
1358
1434
|
};
|
|
1359
|
-
var version = "3.0.
|
|
1435
|
+
var version = "3.0.10-alpha.4";
|
|
1360
1436
|
var ERROR_TYPE_MAP = {
|
|
1361
1437
|
1: "media",
|
|
1362
1438
|
2: "media",
|
|
@@ -1442,6 +1518,7 @@ var CANPLAY_THROUGH = "canplaythrough";
|
|
|
1442
1518
|
var DURATION_CHANGE = "durationchange";
|
|
1443
1519
|
var VOLUME_CHANGE = "volumechange";
|
|
1444
1520
|
var LOADED_DATA = "loadeddata";
|
|
1521
|
+
var LOADED_METADATA = "loadedmetadata";
|
|
1445
1522
|
var RATE_CHANGE = "ratechange";
|
|
1446
1523
|
var PROGRESS = "progress";
|
|
1447
1524
|
var LOAD_START = "loadstart";
|
|
@@ -1481,7 +1558,7 @@ var RESET = "reset";
|
|
|
1481
1558
|
var SOURCE_ERROR = "source_error";
|
|
1482
1559
|
var SOURCE_SUCCESS = "source_success";
|
|
1483
1560
|
var SWITCH_SUBTITLE = "switch_subtitle";
|
|
1484
|
-
var VIDEO_EVENTS = ["play", "playing", "ended", "pause", "error", "seeking", "seeked", "timeupdate", "waiting", "canplay", "canplaythrough", "durationchange", "volumechange", "loadeddata", "ratechange", "progress", "loadstart", "emptied", "stalled", "suspend", "abort", "lowdecode"];
|
|
1561
|
+
var VIDEO_EVENTS = ["play", "playing", "ended", "pause", "error", "seeking", "seeked", "timeupdate", "waiting", "canplay", "canplaythrough", "durationchange", "volumechange", "loadeddata", "loadedmetadata", "ratechange", "progress", "loadstart", "emptied", "stalled", "suspend", "abort", "lowdecode"];
|
|
1485
1562
|
var STATS_EVENTS = {
|
|
1486
1563
|
STATS_INFO: "stats_info",
|
|
1487
1564
|
STATS_DOWNLOAD: "stats_download",
|
|
@@ -1510,6 +1587,7 @@ var XGEvents = /* @__PURE__ */ Object.freeze({
|
|
|
1510
1587
|
FPS_STUCK,
|
|
1511
1588
|
FULLSCREEN_CHANGE,
|
|
1512
1589
|
LOADED_DATA,
|
|
1590
|
+
LOADED_METADATA,
|
|
1513
1591
|
LOAD_START,
|
|
1514
1592
|
MINI_STATE_CHANGE,
|
|
1515
1593
|
PAUSE,
|
|
@@ -1647,6 +1725,9 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1647
1725
|
if (options.loop) {
|
|
1648
1726
|
_this.mediaConfig.loop = "loop";
|
|
1649
1727
|
}
|
|
1728
|
+
if (options.autoplayMuted && !Object.prototype.hasOwnProperty.call(_this.mediaConfig, "muted")) {
|
|
1729
|
+
_this.mediaConfig.muted = true;
|
|
1730
|
+
}
|
|
1650
1731
|
_this.media = util.createDom(_this.mediaConfig.mediaType, "", _this.mediaConfig, "");
|
|
1651
1732
|
if (options.defaultPlaybackRate) {
|
|
1652
1733
|
_this.media.defaultPlaybackRate = _this.media.playbackRate = options.defaultPlaybackRate;
|
|
@@ -1725,10 +1806,11 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1725
1806
|
var _this6 = this;
|
|
1726
1807
|
video.removeAttribute("src");
|
|
1727
1808
|
video.load();
|
|
1728
|
-
urls.forEach(function(item) {
|
|
1809
|
+
urls.forEach(function(item, index) {
|
|
1729
1810
|
_this6.media.appendChild(util.createDom("source", "", {
|
|
1730
1811
|
src: "".concat(item.src),
|
|
1731
|
-
type: "".concat(item.type || "")
|
|
1812
|
+
type: "".concat(item.type || ""),
|
|
1813
|
+
"data-index": index + 1
|
|
1732
1814
|
}));
|
|
1733
1815
|
});
|
|
1734
1816
|
var _c = video.children;
|
|
@@ -1736,6 +1818,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1736
1818
|
return;
|
|
1737
1819
|
}
|
|
1738
1820
|
this._videoSourceCount = _c.length;
|
|
1821
|
+
this._videoSourceIndex = _c.length;
|
|
1739
1822
|
this._vLoadeddata = function(e) {
|
|
1740
1823
|
_this6.emit(SOURCE_SUCCESS, {
|
|
1741
1824
|
src: e.target.currentSrc,
|
|
@@ -1750,8 +1833,9 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1750
1833
|
}
|
|
1751
1834
|
}
|
|
1752
1835
|
!this._sourceError && (this._sourceError = function(e) {
|
|
1753
|
-
|
|
1754
|
-
|
|
1836
|
+
var _dIndex = parseInt(e.target.getAttribute("data-index"), 10);
|
|
1837
|
+
_this6._videoSourceIndex--;
|
|
1838
|
+
if (_this6._videoSourceIndex === 0 || _dIndex >= _this6._videoSourceCount) {
|
|
1755
1839
|
var _err = {
|
|
1756
1840
|
code: 4,
|
|
1757
1841
|
message: "sources_load_error"
|
|
@@ -2078,7 +2162,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
2078
2162
|
this.emit(WAITING);
|
|
2079
2163
|
this._currentTime = 0;
|
|
2080
2164
|
this._duration = 0;
|
|
2081
|
-
if (
|
|
2165
|
+
if (util.isMSE(this.media)) {
|
|
2082
2166
|
this.onWaiting();
|
|
2083
2167
|
return;
|
|
2084
2168
|
}
|
|
@@ -3786,6 +3870,7 @@ function getDefaultConfig$1() {
|
|
|
3786
3870
|
},
|
|
3787
3871
|
enableSwipeHandler: function enableSwipeHandler() {
|
|
3788
3872
|
},
|
|
3873
|
+
preProcessUrl: null,
|
|
3789
3874
|
ignores: [],
|
|
3790
3875
|
whitelist: [],
|
|
3791
3876
|
inactive: 3e3,
|
|
@@ -3867,7 +3952,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
3867
3952
|
autoHide: false
|
|
3868
3953
|
});
|
|
3869
3954
|
});
|
|
3870
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function() {
|
|
3955
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function(e) {
|
|
3871
3956
|
var _assertThisInitialize2 = _assertThisInitialized(_this), player = _assertThisInitialize2.player;
|
|
3872
3957
|
player.focus();
|
|
3873
3958
|
});
|
|
@@ -3945,12 +4030,13 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
3945
4030
|
}, {
|
|
3946
4031
|
key: "show",
|
|
3947
4032
|
value: function show() {
|
|
3948
|
-
|
|
4033
|
+
this.root.style.display = "";
|
|
4034
|
+
this.player.focus();
|
|
3949
4035
|
}
|
|
3950
4036
|
}, {
|
|
3951
4037
|
key: "hide",
|
|
3952
4038
|
value: function hide() {
|
|
3953
|
-
|
|
4039
|
+
this.root.style.display = "none";
|
|
3954
4040
|
}
|
|
3955
4041
|
}, {
|
|
3956
4042
|
key: "mode",
|
|
@@ -4352,6 +4438,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4352
4438
|
_this.cssfullscreen = false;
|
|
4353
4439
|
_this.isRotateFullscreen = false;
|
|
4354
4440
|
_this._fullscreenEl = null;
|
|
4441
|
+
_this.timeSegments = [];
|
|
4355
4442
|
_this._cssfullscreenEl = null;
|
|
4356
4443
|
_this.curDefinition = null;
|
|
4357
4444
|
_this._orgCss = "";
|
|
@@ -4361,7 +4448,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4361
4448
|
_this.videoPos = {
|
|
4362
4449
|
pi: 1,
|
|
4363
4450
|
scale: 0,
|
|
4364
|
-
rotate:
|
|
4451
|
+
rotate: -1,
|
|
4365
4452
|
x: 0,
|
|
4366
4453
|
y: 0,
|
|
4367
4454
|
h: -1,
|
|
@@ -4369,11 +4456,21 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4369
4456
|
vy: 0,
|
|
4370
4457
|
vx: 0
|
|
4371
4458
|
};
|
|
4459
|
+
_this.sizeInfo = {
|
|
4460
|
+
width: 0,
|
|
4461
|
+
height: 0,
|
|
4462
|
+
left: 0,
|
|
4463
|
+
top: 0
|
|
4464
|
+
};
|
|
4372
4465
|
_this._accPlayed = {
|
|
4373
4466
|
t: 0,
|
|
4374
4467
|
acc: 0,
|
|
4375
4468
|
loopAcc: 0
|
|
4376
4469
|
};
|
|
4470
|
+
_this._offsetInfo = {
|
|
4471
|
+
currentTime: -1,
|
|
4472
|
+
duration: 0
|
|
4473
|
+
};
|
|
4377
4474
|
_this.innerContainer = null;
|
|
4378
4475
|
_this.controls = null;
|
|
4379
4476
|
_this.topBar = null;
|
|
@@ -4386,6 +4483,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4386
4483
|
_this.isUserActive = false;
|
|
4387
4484
|
_this._onceSeekCanplay = null;
|
|
4388
4485
|
_this._isPauseBeforeSeek = 0;
|
|
4486
|
+
_this.innerStates = {
|
|
4487
|
+
isActiveLocked: false
|
|
4488
|
+
};
|
|
4389
4489
|
var rootInit = _this._initDOM();
|
|
4390
4490
|
if (!rootInit) {
|
|
4391
4491
|
console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
|
|
@@ -4471,16 +4571,16 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4471
4571
|
this.addClass(STATE_CLASS.NO_START);
|
|
4472
4572
|
}
|
|
4473
4573
|
if (this.config.fluid) {
|
|
4474
|
-
var _this$config3 = this.config,
|
|
4475
|
-
if (typeof
|
|
4476
|
-
|
|
4477
|
-
|
|
4574
|
+
var _this$config3 = this.config, _width = _this$config3.width, _height = _this$config3.height;
|
|
4575
|
+
if (typeof _width !== "number" || typeof _height !== "number") {
|
|
4576
|
+
_width = 600;
|
|
4577
|
+
_height = 337.5;
|
|
4478
4578
|
}
|
|
4479
4579
|
var style = {
|
|
4480
4580
|
width: "100%",
|
|
4481
4581
|
height: "0",
|
|
4482
4582
|
"max-width": "100%",
|
|
4483
|
-
"padding-top": "".concat(
|
|
4583
|
+
"padding-top": "".concat(_height * 100 / _width, "%")
|
|
4484
4584
|
};
|
|
4485
4585
|
Object.keys(style).forEach(function(key) {
|
|
4486
4586
|
_this2.root.style[key] = style[key];
|
|
@@ -4496,6 +4596,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4496
4596
|
}
|
|
4497
4597
|
});
|
|
4498
4598
|
}
|
|
4599
|
+
var _this$root$getBoundin = this.root.getBoundingClientRect(), width = _this$root$getBoundin.width, height = _this$root$getBoundin.height, left = _this$root$getBoundin.left, top = _this$root$getBoundin.top;
|
|
4600
|
+
this.sizeInfo.width = width;
|
|
4601
|
+
this.sizeInfo.height = height;
|
|
4602
|
+
this.sizeInfo.left = left;
|
|
4603
|
+
this.sizeInfo.top = top;
|
|
4499
4604
|
return true;
|
|
4500
4605
|
}
|
|
4501
4606
|
}, {
|
|
@@ -4579,7 +4684,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4579
4684
|
var readyState = this.media.readyState;
|
|
4580
4685
|
XG_DEBUG.logInfo("_startInit readyState", readyState);
|
|
4581
4686
|
if (this.config.autoplay) {
|
|
4582
|
-
!
|
|
4687
|
+
!util.isMSE(this.media) && this.load();
|
|
4583
4688
|
(sniffer.os.isIpad || sniffer.os.isPhone) && this.mediaPlay();
|
|
4584
4689
|
}
|
|
4585
4690
|
if (readyState >= 2) {
|
|
@@ -4807,7 +4912,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4807
4912
|
if (!url) {
|
|
4808
4913
|
url = _this8.url || _this8.config.url;
|
|
4809
4914
|
}
|
|
4810
|
-
var
|
|
4915
|
+
var _furl = _this8.preProcessUrl(url);
|
|
4916
|
+
var ret = _this8._startInit(_furl.url);
|
|
4811
4917
|
return ret;
|
|
4812
4918
|
}).catch(function(e) {
|
|
4813
4919
|
e.fileName = "player";
|
|
@@ -4824,6 +4930,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4824
4930
|
if (util.typeOf(url) === "Object") {
|
|
4825
4931
|
_src = url.url;
|
|
4826
4932
|
}
|
|
4933
|
+
_src = this.preProcessUrl(_src).url;
|
|
4827
4934
|
var curTime = this.currentTime;
|
|
4828
4935
|
var isPaused = this.paused && !this.isError;
|
|
4829
4936
|
this.src = _src;
|
|
@@ -5162,7 +5269,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5162
5269
|
this.addClass(STATE_CLASS.LOADING);
|
|
5163
5270
|
runHooks(this, "retry", function() {
|
|
5164
5271
|
var cur = _this20.currentTime;
|
|
5165
|
-
|
|
5272
|
+
var url = _this20.config.url;
|
|
5273
|
+
var _srcRet = !util.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
|
|
5274
|
+
url
|
|
5275
|
+
};
|
|
5276
|
+
_this20.src = _srcRet.url;
|
|
5166
5277
|
!_this20.config.isLive && (_this20.currentTime = cur);
|
|
5167
5278
|
_this20.once(CANPLAY, function() {
|
|
5168
5279
|
_this20.mediaPlay();
|
|
@@ -5223,7 +5334,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5223
5334
|
var fullEl = util.getFullScreenEl();
|
|
5224
5335
|
if (fullEl === this._fullscreenEl) {
|
|
5225
5336
|
this.onFullscreenChange();
|
|
5226
|
-
return;
|
|
5337
|
+
return Promise.resolve();
|
|
5227
5338
|
}
|
|
5228
5339
|
try {
|
|
5229
5340
|
for (var i = 0; i < GET_FULLSCREEN_API.length; i++) {
|
|
@@ -5396,30 +5507,38 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5396
5507
|
key: "onFocus",
|
|
5397
5508
|
value: function onFocus() {
|
|
5398
5509
|
var _this21 = this;
|
|
5399
|
-
var
|
|
5510
|
+
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
5511
|
+
autoHide: true,
|
|
5512
|
+
delay: 3e3
|
|
5513
|
+
};
|
|
5514
|
+
var innerStates = this.innerStates;
|
|
5400
5515
|
this.isActive = true;
|
|
5401
5516
|
this.removeClass(STATE_CLASS.INACTIVE);
|
|
5402
5517
|
if (this.userTimer) {
|
|
5403
5518
|
util.clearTimeout(this, this.userTimer);
|
|
5404
5519
|
this.userTimer = null;
|
|
5405
5520
|
}
|
|
5406
|
-
if (
|
|
5521
|
+
if (data.isLock !== void 0) {
|
|
5522
|
+
innerStates.isActiveLocked = data.isLock;
|
|
5523
|
+
}
|
|
5524
|
+
if (data.autoHide === false || data.isLock === true || innerStates.isActiveLocked) {
|
|
5407
5525
|
if (this.userTimer) {
|
|
5408
5526
|
util.clearTimeout(this, this.userTimer);
|
|
5409
5527
|
this.userTimer = null;
|
|
5410
5528
|
}
|
|
5411
5529
|
return;
|
|
5412
5530
|
}
|
|
5531
|
+
var time = data && data.delay ? data.delay : this.config.inactive;
|
|
5413
5532
|
this.userTimer = util.setTimeout(this, function() {
|
|
5414
5533
|
_this21.userTimer = null;
|
|
5415
5534
|
_this21.blur();
|
|
5416
|
-
},
|
|
5535
|
+
}, time);
|
|
5417
5536
|
}
|
|
5418
5537
|
}, {
|
|
5419
5538
|
key: "onBlur",
|
|
5420
5539
|
value: function onBlur() {
|
|
5421
|
-
var
|
|
5422
|
-
if (!this.isActive) {
|
|
5540
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$ignorePaused = _ref.ignorePaused, ignorePaused = _ref$ignorePaused === void 0 ? false : _ref$ignorePaused;
|
|
5541
|
+
if (!this.isActive || this.innerStates.isActiveLocked) {
|
|
5423
5542
|
return;
|
|
5424
5543
|
}
|
|
5425
5544
|
var closePauseVideoFocus = this.config.closePauseVideoFocus;
|
|
@@ -5542,7 +5661,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5542
5661
|
}, {
|
|
5543
5662
|
key: "onTimeupdate",
|
|
5544
5663
|
value: function onTimeupdate() {
|
|
5545
|
-
!this._videoHeight && this.resize();
|
|
5664
|
+
!this._videoHeight && this.media.videoHeight && this.resize();
|
|
5546
5665
|
if ((this.waitTimer || this.hasClass(STATE_CLASS.LOADING)) && this.media.readyState > 2) {
|
|
5547
5666
|
this.removeClass(STATE_CLASS.LOADING);
|
|
5548
5667
|
util.clearTimeout(this, this.waitTimer);
|
|
@@ -5617,8 +5736,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5617
5736
|
key: "resizePosition",
|
|
5618
5737
|
value: function resizePosition() {
|
|
5619
5738
|
var _this$videoPos = this.videoPos, rotate = _this$videoPos.rotate, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h = _this$videoPos.h, w = _this$videoPos.w;
|
|
5739
|
+
if (rotate < 0 && !vy && !vx) {
|
|
5740
|
+
return;
|
|
5741
|
+
}
|
|
5620
5742
|
var _pi = this.videoPos._pi;
|
|
5621
|
-
if (!_pi) {
|
|
5743
|
+
if (!_pi && this.media.videoHeight) {
|
|
5622
5744
|
_pi = this.media.videoWidth / this.media.videoHeight * 100;
|
|
5623
5745
|
}
|
|
5624
5746
|
if (!_pi) {
|
|
@@ -5718,9 +5840,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5718
5840
|
if (!this.media) {
|
|
5719
5841
|
return;
|
|
5720
5842
|
}
|
|
5843
|
+
var containerSize = this.root.getBoundingClientRect();
|
|
5844
|
+
this.sizeInfo.width = containerSize.width;
|
|
5845
|
+
this.sizeInfo.height = containerSize.height;
|
|
5846
|
+
this.sizeInfo.left = containerSize.left;
|
|
5847
|
+
this.sizeInfo.top = containerSize.top;
|
|
5721
5848
|
var _this$media = this.media, videoWidth = _this$media.videoWidth, videoHeight = _this$media.videoHeight;
|
|
5722
5849
|
var _this$config6 = this.config, fitVideoSize = _this$config6.fitVideoSize, videoFillMode = _this$config6.videoFillMode;
|
|
5723
|
-
if (videoFillMode === "fill" || videoFillMode === "cover") {
|
|
5850
|
+
if (videoFillMode === "fill" || videoFillMode === "cover" || videoFillMode === "contain") {
|
|
5724
5851
|
this.setAttribute("data-xgfill", videoFillMode);
|
|
5725
5852
|
}
|
|
5726
5853
|
if (!videoHeight || !videoWidth) {
|
|
@@ -5728,7 +5855,6 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5728
5855
|
}
|
|
5729
5856
|
this._videoHeight = videoHeight;
|
|
5730
5857
|
this._videoWidth = videoWidth;
|
|
5731
|
-
var containerSize = this.root.getBoundingClientRect();
|
|
5732
5858
|
var controlsHeight = this.controls && this.innerContainer ? this.controls.root.getBoundingClientRect().height : 0;
|
|
5733
5859
|
var width = containerSize.width;
|
|
5734
5860
|
var height = containerSize.height - controlsHeight;
|
|
@@ -5783,6 +5909,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5783
5909
|
XG_DEBUG.logInfo("setState", "state from:".concat(STATE_ARRAY[this.state], " to:").concat(STATE_ARRAY[newState]));
|
|
5784
5910
|
this._state = newState;
|
|
5785
5911
|
}
|
|
5912
|
+
}, {
|
|
5913
|
+
key: "preProcessUrl",
|
|
5914
|
+
value: function preProcessUrl(url, ext) {
|
|
5915
|
+
var preProcessUrl2 = this.config.preProcessUrl;
|
|
5916
|
+
return !util.isBlob(url) && preProcessUrl2 && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, ext) : {
|
|
5917
|
+
url
|
|
5918
|
+
};
|
|
5919
|
+
}
|
|
5786
5920
|
}, {
|
|
5787
5921
|
key: "state",
|
|
5788
5922
|
get: function get() {
|
|
@@ -5956,9 +6090,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5956
6090
|
}, {
|
|
5957
6091
|
key: "cumulateTime",
|
|
5958
6092
|
get: function get() {
|
|
5959
|
-
var _accPlayed = this._accPlayed;
|
|
5960
|
-
|
|
5961
|
-
return _accPlayed.acc;
|
|
6093
|
+
var _this$_accPlayed = this._accPlayed, acc = _this$_accPlayed.acc, t = _this$_accPlayed.t;
|
|
6094
|
+
return t ? (/* @__PURE__ */ new Date()).getTime() - t + acc : acc;
|
|
5962
6095
|
}
|
|
5963
6096
|
}, {
|
|
5964
6097
|
key: "zoom",
|
|
@@ -5997,6 +6130,22 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5997
6130
|
set: function set(val) {
|
|
5998
6131
|
REAL_TIME_SPEED = val;
|
|
5999
6132
|
}
|
|
6133
|
+
}, {
|
|
6134
|
+
key: "offsetCurrentTime",
|
|
6135
|
+
get: function get() {
|
|
6136
|
+
return this._offsetInfo.currentTime || 0;
|
|
6137
|
+
},
|
|
6138
|
+
set: function set(val) {
|
|
6139
|
+
this._offsetInfo.currentTime = val;
|
|
6140
|
+
}
|
|
6141
|
+
}, {
|
|
6142
|
+
key: "offsetDuration",
|
|
6143
|
+
get: function get() {
|
|
6144
|
+
return this._offsetInfo.duration || 0;
|
|
6145
|
+
},
|
|
6146
|
+
set: function set(val) {
|
|
6147
|
+
this._offsetInfo.duration = val || 0;
|
|
6148
|
+
}
|
|
6000
6149
|
}, {
|
|
6001
6150
|
key: "hook",
|
|
6002
6151
|
value: function hook$1(hookName, handler) {
|
|
@@ -6122,7 +6271,7 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
6122
6271
|
ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
|
|
6123
6272
|
ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
|
|
6124
6273
|
ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
|
|
6125
|
-
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] =
|
|
6274
|
+
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
|
|
6126
6275
|
ErrorCode2["UNKNOWN"] = "UNKNOWN";
|
|
6127
6276
|
return ErrorCode2;
|
|
6128
6277
|
})(ErrorCode || {});
|
|
@@ -6208,7 +6357,7 @@ const ERROR_INFO = {
|
|
|
6208
6357
|
/* Error */
|
|
6209
6358
|
},
|
|
6210
6359
|
[
|
|
6211
|
-
|
|
6360
|
+
110
|
|
6212
6361
|
/* MODULE_LOAD_ERROR */
|
|
6213
6362
|
]: {
|
|
6214
6363
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
@@ -6283,6 +6432,11 @@ const ERROR_TYPE_INFO = {
|
|
|
6283
6432
|
}
|
|
6284
6433
|
};
|
|
6285
6434
|
class VeError extends Error {
|
|
6435
|
+
/**
|
|
6436
|
+
* @hidden
|
|
6437
|
+
* @param error
|
|
6438
|
+
* @param i18n
|
|
6439
|
+
*/
|
|
6286
6440
|
constructor(error2, i18n) {
|
|
6287
6441
|
var _a;
|
|
6288
6442
|
const errorInfo = typeof error2 === "string" ? {
|
|
@@ -6290,8 +6444,17 @@ class VeError extends Error {
|
|
|
6290
6444
|
} : error2;
|
|
6291
6445
|
const message = (i18n == null ? void 0 : i18n.getText(errorInfo == null ? void 0 : errorInfo.messageTextKey)) ?? (errorInfo == null ? void 0 : errorInfo.message) ?? ((_a = errorInfo == null ? void 0 : errorInfo.error) == null ? void 0 : _a.message) ?? (i18n == null ? void 0 : i18n.getText("UNKNOWN"));
|
|
6292
6446
|
super(message);
|
|
6447
|
+
/**
|
|
6448
|
+
* @brief 错误码,对应[错误码字典](#错误码)。
|
|
6449
|
+
*/
|
|
6293
6450
|
__publicField(this, "errorCode");
|
|
6451
|
+
/**
|
|
6452
|
+
* @brief 错误等级。
|
|
6453
|
+
*/
|
|
6294
6454
|
__publicField(this, "level");
|
|
6455
|
+
/**
|
|
6456
|
+
* @brief 其他错误信息。
|
|
6457
|
+
*/
|
|
6295
6458
|
__publicField(this, "ext");
|
|
6296
6459
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6297
6460
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -7628,10 +7791,56 @@ function getDefaultConfig() {
|
|
|
7628
7791
|
var Touche = /* @__PURE__ */ function() {
|
|
7629
7792
|
function Touche2(dom) {
|
|
7630
7793
|
var _this = this;
|
|
7631
|
-
var
|
|
7794
|
+
var _config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7632
7795
|
eventType: "touch"
|
|
7633
7796
|
};
|
|
7634
7797
|
_classCallCheck(this, Touche2);
|
|
7798
|
+
_defineProperty(this, "onTouchStart", function(e) {
|
|
7799
|
+
var _pos = _this._pos, root = _this.root;
|
|
7800
|
+
var touch = getTouch(e.touches);
|
|
7801
|
+
_pos.x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7802
|
+
_pos.y = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7803
|
+
_pos.start = true;
|
|
7804
|
+
_this.__setPress(e);
|
|
7805
|
+
root.addEventListener(_this.events.end, _this.onTouchEnd);
|
|
7806
|
+
root.addEventListener(_this.events.cancel, _this.onTouchCancel);
|
|
7807
|
+
root.addEventListener(_this.events.move, _this.onTouchMove);
|
|
7808
|
+
_this.trigger(EVENTS.TOUCH_START, e);
|
|
7809
|
+
});
|
|
7810
|
+
_defineProperty(this, "onTouchCancel", function(e) {
|
|
7811
|
+
_this.onTouchEnd(e);
|
|
7812
|
+
});
|
|
7813
|
+
_defineProperty(this, "onTouchEnd", function(e) {
|
|
7814
|
+
var _pos = _this._pos, root = _this.root;
|
|
7815
|
+
_this.__clearPress();
|
|
7816
|
+
root.removeEventListener(_this.events.cancel, _this.onTouchCancel);
|
|
7817
|
+
root.removeEventListener(_this.events.end, _this.onTouchEnd);
|
|
7818
|
+
root.removeEventListener(_this.events.move, _this.onTouchMove);
|
|
7819
|
+
e.moving = _pos.moving;
|
|
7820
|
+
e.press = _pos.press;
|
|
7821
|
+
_pos.press && _this.trigger(EVENTS.PRESS_END, e);
|
|
7822
|
+
_this.trigger(EVENTS.TOUCH_END, e);
|
|
7823
|
+
!_pos.press && !_pos.moving && _this.__setDb(e);
|
|
7824
|
+
_pos.press = false;
|
|
7825
|
+
_pos.start = false;
|
|
7826
|
+
_pos.moving = false;
|
|
7827
|
+
});
|
|
7828
|
+
_defineProperty(this, "onTouchMove", function(e) {
|
|
7829
|
+
var _pos = _this._pos, config = _this.config;
|
|
7830
|
+
var touch = getTouch(e.touches);
|
|
7831
|
+
var x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7832
|
+
var y = touch ? parseInt(touch.pageY, 10) : e.pageX;
|
|
7833
|
+
var diffx = x - _pos.x;
|
|
7834
|
+
var diffy = y - _pos.y;
|
|
7835
|
+
if (Math.abs(diffy) < config.miniStep && Math.abs(diffx) < config.miniStep) {
|
|
7836
|
+
return;
|
|
7837
|
+
}
|
|
7838
|
+
_this.__clearPress();
|
|
7839
|
+
_pos.press && _this.trigger(EVENTS.PRESS_END, e);
|
|
7840
|
+
_pos.press = false;
|
|
7841
|
+
_pos.moving = true;
|
|
7842
|
+
_this.trigger(EVENTS.TOUCH_MOVE, e);
|
|
7843
|
+
});
|
|
7635
7844
|
this._pos = {
|
|
7636
7845
|
moving: false,
|
|
7637
7846
|
start: false,
|
|
@@ -7639,11 +7848,11 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7639
7848
|
y: 0
|
|
7640
7849
|
};
|
|
7641
7850
|
this.config = getDefaultConfig();
|
|
7642
|
-
Object.keys(
|
|
7643
|
-
_this.config[key] =
|
|
7851
|
+
Object.keys(_config).map(function(key) {
|
|
7852
|
+
_this.config[key] = _config[key];
|
|
7644
7853
|
});
|
|
7645
7854
|
this.root = dom;
|
|
7646
|
-
this.events =
|
|
7855
|
+
this.events = _config.eventType === "mouse" ? MOUSES : TOUCHS;
|
|
7647
7856
|
this.pressIntrvalId = null;
|
|
7648
7857
|
this.dbIntrvalId = null;
|
|
7649
7858
|
this.__handlers = {};
|
|
@@ -7652,10 +7861,6 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7652
7861
|
_createClass(Touche2, [{
|
|
7653
7862
|
key: "_initEvent",
|
|
7654
7863
|
value: function _initEvent() {
|
|
7655
|
-
this.onTouchStart = this.onTouchStart.bind(this);
|
|
7656
|
-
this.onTouchMove = this.onTouchMove.bind(this);
|
|
7657
|
-
this.onTouchEnd = this.onTouchEnd.bind(this);
|
|
7658
|
-
this.onTouchCancel = this.onTouchCancel.bind(this);
|
|
7659
7864
|
this.root.addEventListener(this.events.start, this.onTouchStart);
|
|
7660
7865
|
}
|
|
7661
7866
|
}, {
|
|
@@ -7741,60 +7946,6 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7741
7946
|
}
|
|
7742
7947
|
});
|
|
7743
7948
|
}
|
|
7744
|
-
}, {
|
|
7745
|
-
key: "onTouchStart",
|
|
7746
|
-
value: function onTouchStart(e) {
|
|
7747
|
-
var _pos = this._pos, root = this.root;
|
|
7748
|
-
var touch = getTouch(e.touches);
|
|
7749
|
-
_pos.x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7750
|
-
_pos.y = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7751
|
-
_pos.start = true;
|
|
7752
|
-
this.__setPress(e);
|
|
7753
|
-
root.addEventListener(this.events.end, this.onTouchEnd);
|
|
7754
|
-
root.addEventListener(this.events.cancel, this.onTouchCancel);
|
|
7755
|
-
root.addEventListener(this.events.move, this.onTouchMove);
|
|
7756
|
-
this.trigger(EVENTS.TOUCH_START, e);
|
|
7757
|
-
}
|
|
7758
|
-
}, {
|
|
7759
|
-
key: "onTouchCancel",
|
|
7760
|
-
value: function onTouchCancel(e) {
|
|
7761
|
-
this.onTouchEnd(e);
|
|
7762
|
-
}
|
|
7763
|
-
}, {
|
|
7764
|
-
key: "onTouchEnd",
|
|
7765
|
-
value: function onTouchEnd(e) {
|
|
7766
|
-
var _pos = this._pos, root = this.root;
|
|
7767
|
-
this.__clearPress();
|
|
7768
|
-
root.removeEventListener(this.events.cancel, this.onTouchCancel);
|
|
7769
|
-
root.removeEventListener(this.events.end, this.onTouchEnd);
|
|
7770
|
-
root.removeEventListener(this.events.move, this.onTouchMove);
|
|
7771
|
-
e.moving = _pos.moving;
|
|
7772
|
-
e.press = _pos.press;
|
|
7773
|
-
_pos.press && this.trigger(EVENTS.PRESS_END, e);
|
|
7774
|
-
this.trigger(EVENTS.TOUCH_END, e);
|
|
7775
|
-
!_pos.press && !_pos.moving && this.__setDb(e);
|
|
7776
|
-
_pos.press = false;
|
|
7777
|
-
_pos.start = false;
|
|
7778
|
-
_pos.moving = false;
|
|
7779
|
-
}
|
|
7780
|
-
}, {
|
|
7781
|
-
key: "onTouchMove",
|
|
7782
|
-
value: function onTouchMove(e) {
|
|
7783
|
-
var _pos = this._pos, config = this.config;
|
|
7784
|
-
var touch = getTouch(e.touches);
|
|
7785
|
-
var x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7786
|
-
var y = touch ? parseInt(touch.pageY, 10) : e.pageX;
|
|
7787
|
-
var diffx = x - _pos.x;
|
|
7788
|
-
var diffy = y - _pos.y;
|
|
7789
|
-
if (Math.abs(diffy) < config.miniStep && Math.abs(diffx) < config.miniStep) {
|
|
7790
|
-
return;
|
|
7791
|
-
}
|
|
7792
|
-
this.__clearPress();
|
|
7793
|
-
_pos.press && this.trigger(EVENTS.PRESS_END, e);
|
|
7794
|
-
_pos.press = false;
|
|
7795
|
-
_pos.moving = true;
|
|
7796
|
-
this.trigger(EVENTS.TOUCH_MOVE, e);
|
|
7797
|
-
}
|
|
7798
7949
|
}, {
|
|
7799
7950
|
key: "destroy",
|
|
7800
7951
|
value: function destroy2() {
|
|
@@ -7804,8 +7955,8 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7804
7955
|
touchmove: "onTouchMove",
|
|
7805
7956
|
touchstart: "onTouchStart"
|
|
7806
7957
|
};
|
|
7807
|
-
Object.keys(map).
|
|
7808
|
-
_this4.root.removeEventListener(
|
|
7958
|
+
Object.keys(map).forEach(function(key) {
|
|
7959
|
+
_this4.root.removeEventListener(key, _this4[map[key]]);
|
|
7809
7960
|
});
|
|
7810
7961
|
}
|
|
7811
7962
|
}]);
|
|
@@ -8456,38 +8607,61 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8456
8607
|
}
|
|
8457
8608
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
8458
8609
|
_defineProperty(_assertThisInitialized(_this), "onBodyKeyDown", function(event) {
|
|
8459
|
-
|
|
8460
|
-
if (!_this.player || !_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
8610
|
+
if (!_this.player) {
|
|
8461
8611
|
return;
|
|
8462
8612
|
}
|
|
8463
|
-
|
|
8613
|
+
var e = event || window.event;
|
|
8614
|
+
var keyCode = e.keyCode;
|
|
8615
|
+
var _assertThisInitialize = _assertThisInitialized(_this), _keyState = _assertThisInitialize._keyState, player = _assertThisInitialize.player;
|
|
8616
|
+
var _this$config = _this.config, disable = _this$config.disable, disableBodyTrigger = _this$config.disableBodyTrigger, isIgnoreUserActive = _this$config.isIgnoreUserActive;
|
|
8617
|
+
if (disable || disableBodyTrigger || !player.isUserActive && !isIgnoreUserActive || isDisableTag(e.target) || !_this.checkIsVisible() || e.metaKey || e.altKey || e.ctrlKey) {
|
|
8618
|
+
_keyState.isBodyKeyDown = false;
|
|
8464
8619
|
return;
|
|
8465
8620
|
}
|
|
8466
|
-
|
|
8467
|
-
|
|
8468
|
-
|
|
8469
|
-
|
|
8470
|
-
|
|
8621
|
+
if (!event.repeat && !_keyState.isKeyDown) {
|
|
8622
|
+
if ((e.target === document.body || _this.config.isGlobalTrigger && !isDisableTag(e.target)) && _this.checkCode(keyCode, true)) {
|
|
8623
|
+
_keyState.isBodyKeyDown = true;
|
|
8624
|
+
}
|
|
8625
|
+
document.addEventListener("keyup", _this.onBodyKeyUp);
|
|
8471
8626
|
}
|
|
8472
|
-
|
|
8627
|
+
_keyState.isBodyKeyDown && _this.handleKeyDown(e);
|
|
8473
8628
|
});
|
|
8474
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
8475
|
-
|
|
8476
|
-
if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
|
|
8629
|
+
_defineProperty(_assertThisInitialized(_this), "onBodyKeyUp", function(event) {
|
|
8630
|
+
if (!_this.player) {
|
|
8477
8631
|
return;
|
|
8478
8632
|
}
|
|
8479
|
-
|
|
8633
|
+
document.removeEventListener("keyup", _this.onBodyKeyUp);
|
|
8634
|
+
_this.handleKeyUp(event);
|
|
8635
|
+
});
|
|
8636
|
+
_defineProperty(_assertThisInitialized(_this), "onKeydown", function(event) {
|
|
8637
|
+
if (!_this.player) {
|
|
8480
8638
|
return;
|
|
8481
8639
|
}
|
|
8482
|
-
|
|
8640
|
+
var e = event || window.event;
|
|
8641
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), _keyState = _assertThisInitialize2._keyState;
|
|
8642
|
+
if (!e.repeat) {
|
|
8643
|
+
if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
|
|
8644
|
+
return;
|
|
8645
|
+
}
|
|
8646
|
+
if (!_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
8647
|
+
return;
|
|
8648
|
+
}
|
|
8649
|
+
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)) {
|
|
8650
|
+
_keyState.isKeyDown = true;
|
|
8651
|
+
}
|
|
8652
|
+
_this.player.root.addEventListener("keyup", _this.onKeyup);
|
|
8653
|
+
}
|
|
8654
|
+
if (!_keyState.isKeyDown) {
|
|
8483
8655
|
return;
|
|
8484
8656
|
}
|
|
8485
|
-
|
|
8486
|
-
|
|
8487
|
-
|
|
8488
|
-
|
|
8657
|
+
_this.handleKeyDown(e);
|
|
8658
|
+
});
|
|
8659
|
+
_defineProperty(_assertThisInitialized(_this), "onKeyup", function(event) {
|
|
8660
|
+
if (!_this.player) {
|
|
8661
|
+
return;
|
|
8489
8662
|
}
|
|
8490
|
-
_this.
|
|
8663
|
+
_this.player.root.removeEventListener("keyup", _this.onKeyup);
|
|
8664
|
+
_this.handleKeyUp(event);
|
|
8491
8665
|
});
|
|
8492
8666
|
return _this;
|
|
8493
8667
|
}
|
|
@@ -8501,7 +8675,7 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8501
8675
|
if (!_this2.keyCodeMap[key]) {
|
|
8502
8676
|
_this2.keyCodeMap[key] = extendkeyCodeMap[key];
|
|
8503
8677
|
} else {
|
|
8504
|
-
["keyCode", "action", "disable", "isBodyTarget"].map(function(key1) {
|
|
8678
|
+
["keyCode", "action", "disable", "pressAction", "disablePress", "isBodyTarget"].map(function(key1) {
|
|
8505
8679
|
extendkeyCodeMap[key][key1] && (_this2.keyCodeMap[key][key1] = extendkeyCodeMap[key][key1]);
|
|
8506
8680
|
});
|
|
8507
8681
|
}
|
|
@@ -8521,37 +8695,51 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8521
8695
|
keyCode: 32,
|
|
8522
8696
|
action: "playPause",
|
|
8523
8697
|
disable: false,
|
|
8698
|
+
disablePress: false,
|
|
8524
8699
|
noBodyTarget: false
|
|
8525
8700
|
},
|
|
8526
8701
|
up: {
|
|
8527
8702
|
keyCode: 38,
|
|
8528
8703
|
action: "upVolume",
|
|
8529
8704
|
disable: false,
|
|
8705
|
+
disablePress: false,
|
|
8530
8706
|
noBodyTarget: true
|
|
8531
8707
|
},
|
|
8532
8708
|
down: {
|
|
8533
8709
|
keyCode: 40,
|
|
8534
8710
|
action: "downVolume",
|
|
8535
8711
|
disable: false,
|
|
8712
|
+
disablePress: false,
|
|
8536
8713
|
noBodyTarget: true
|
|
8537
8714
|
},
|
|
8538
8715
|
left: {
|
|
8539
8716
|
keyCode: 37,
|
|
8540
8717
|
action: "seekBack",
|
|
8718
|
+
disablePress: false,
|
|
8541
8719
|
disable: false
|
|
8542
8720
|
},
|
|
8543
8721
|
right: {
|
|
8544
8722
|
keyCode: 39,
|
|
8545
8723
|
action: "seek",
|
|
8724
|
+
pressAction: "changePlaybackRate",
|
|
8725
|
+
disablePress: false,
|
|
8546
8726
|
disable: false
|
|
8547
8727
|
},
|
|
8548
8728
|
esc: {
|
|
8549
8729
|
keyCode: 27,
|
|
8550
8730
|
action: "exitFullscreen",
|
|
8731
|
+
disablePress: true,
|
|
8551
8732
|
disable: false
|
|
8552
8733
|
}
|
|
8553
8734
|
};
|
|
8554
8735
|
this.mergekeyCodeMap();
|
|
8736
|
+
this._keyState = {
|
|
8737
|
+
isKeyDown: false,
|
|
8738
|
+
isBodyKeyDown: false,
|
|
8739
|
+
isPress: false,
|
|
8740
|
+
tt: 0,
|
|
8741
|
+
playbackRate: 0
|
|
8742
|
+
};
|
|
8555
8743
|
this.player.root.addEventListener("keydown", this.onKeydown);
|
|
8556
8744
|
document.addEventListener("keydown", this.onBodyKeyDown);
|
|
8557
8745
|
}
|
|
@@ -8585,6 +8773,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8585
8773
|
key: "downVolume",
|
|
8586
8774
|
value: function downVolume(event) {
|
|
8587
8775
|
var player = this.player;
|
|
8776
|
+
if (player.volume <= 0) {
|
|
8777
|
+
return;
|
|
8778
|
+
}
|
|
8588
8779
|
var val = parseFloat((player.volume - 0.1).toFixed(1));
|
|
8589
8780
|
var props = {
|
|
8590
8781
|
volume: {
|
|
@@ -8605,6 +8796,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8605
8796
|
key: "upVolume",
|
|
8606
8797
|
value: function upVolume(event) {
|
|
8607
8798
|
var player = this.player;
|
|
8799
|
+
if (player.volume >= 1) {
|
|
8800
|
+
return;
|
|
8801
|
+
}
|
|
8608
8802
|
var val = parseFloat((player.volume + 0.1).toFixed(1));
|
|
8609
8803
|
var props = {
|
|
8610
8804
|
volume: {
|
|
@@ -8624,42 +8818,57 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8624
8818
|
}, {
|
|
8625
8819
|
key: "seek",
|
|
8626
8820
|
value: function seek(event) {
|
|
8627
|
-
var _this$player = this.player, currentTime = _this$player.currentTime, duration = _this$player.duration;
|
|
8628
|
-
var _time = currentTime;
|
|
8629
|
-
|
|
8630
|
-
|
|
8821
|
+
var _this$player = this.player, currentTime = _this$player.currentTime, offsetCurrentTime = _this$player.offsetCurrentTime, duration = _this$player.duration, offsetDuration = _this$player.offsetDuration, timeSegments = _this$player.timeSegments;
|
|
8822
|
+
var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
|
|
8823
|
+
var _duration = offsetDuration || duration;
|
|
8824
|
+
var _step = event.repeat && this.seekStep >= 4 ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
8825
|
+
if (_time + _step <= _duration) {
|
|
8826
|
+
_time = _time + _step;
|
|
8631
8827
|
} else {
|
|
8632
|
-
_time =
|
|
8828
|
+
_time = _duration;
|
|
8633
8829
|
}
|
|
8830
|
+
var _seekTime = util.getCurrentTimeByOffset(_time, timeSegments);
|
|
8634
8831
|
var props = {
|
|
8635
8832
|
currentTime: {
|
|
8636
8833
|
from: currentTime,
|
|
8637
|
-
to:
|
|
8834
|
+
to: _seekTime
|
|
8638
8835
|
}
|
|
8639
8836
|
};
|
|
8640
8837
|
this.emitUserAction(event, "seek", {
|
|
8641
8838
|
props
|
|
8642
8839
|
});
|
|
8643
|
-
this.player.currentTime =
|
|
8840
|
+
this.player.currentTime = _seekTime;
|
|
8644
8841
|
}
|
|
8645
8842
|
}, {
|
|
8646
8843
|
key: "seekBack",
|
|
8647
8844
|
value: function seekBack(event) {
|
|
8648
|
-
var
|
|
8649
|
-
var
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8845
|
+
var _this$player2 = this.player, currentTime = _this$player2.currentTime, offsetCurrentTime = _this$player2.offsetCurrentTime, timeSegments = _this$player2.timeSegments;
|
|
8846
|
+
var _step = event.repeat ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
8847
|
+
var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
|
|
8848
|
+
var _seekTime = _time - _step;
|
|
8849
|
+
if (_seekTime < 0) {
|
|
8850
|
+
_seekTime = 0;
|
|
8851
|
+
}
|
|
8852
|
+
_seekTime = util.getCurrentTimeByOffset(_seekTime, timeSegments);
|
|
8653
8853
|
var props = {
|
|
8654
8854
|
currentTime: {
|
|
8655
8855
|
from: currentTime,
|
|
8656
|
-
to:
|
|
8856
|
+
to: _seekTime
|
|
8657
8857
|
}
|
|
8658
8858
|
};
|
|
8659
8859
|
this.emitUserAction(event, "seek", {
|
|
8660
8860
|
props
|
|
8661
8861
|
});
|
|
8662
|
-
this.player.currentTime =
|
|
8862
|
+
this.player.currentTime = _seekTime;
|
|
8863
|
+
}
|
|
8864
|
+
}, {
|
|
8865
|
+
key: "changePlaybackRate",
|
|
8866
|
+
value: function changePlaybackRate(event) {
|
|
8867
|
+
var _keyState = this._keyState, config = this.config, player = this.player;
|
|
8868
|
+
if (_keyState.playbackRate === 0) {
|
|
8869
|
+
_keyState.playbackRate = player.playbackRate;
|
|
8870
|
+
player.playbackRate = config.playbackRate;
|
|
8871
|
+
}
|
|
8663
8872
|
}
|
|
8664
8873
|
}, {
|
|
8665
8874
|
key: "playPause",
|
|
@@ -8697,32 +8906,66 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8697
8906
|
player.exitCssFullscreen();
|
|
8698
8907
|
}
|
|
8699
8908
|
}
|
|
8909
|
+
}, {
|
|
8910
|
+
key: "handleKeyDown",
|
|
8911
|
+
value: function handleKeyDown(e) {
|
|
8912
|
+
var _keyState = this._keyState;
|
|
8913
|
+
if (e.repeat) {
|
|
8914
|
+
_keyState.isPress = true;
|
|
8915
|
+
var _t = Date.now();
|
|
8916
|
+
if (_t - _keyState.tt < 200) {
|
|
8917
|
+
return;
|
|
8918
|
+
}
|
|
8919
|
+
_keyState.tt = _t;
|
|
8920
|
+
}
|
|
8921
|
+
preventDefault(e);
|
|
8922
|
+
this.handleKeyCode(e.keyCode, e, _keyState.isPress);
|
|
8923
|
+
}
|
|
8924
|
+
}, {
|
|
8925
|
+
key: "handleKeyUp",
|
|
8926
|
+
value: function handleKeyUp(e) {
|
|
8927
|
+
var _keyState = this._keyState;
|
|
8928
|
+
if (_keyState.playbackRate > 0) {
|
|
8929
|
+
this.player.playbackRate = _keyState.playbackRate;
|
|
8930
|
+
_keyState.playbackRate = 0;
|
|
8931
|
+
}
|
|
8932
|
+
_keyState.isKeyDown = false;
|
|
8933
|
+
_keyState.isPress = false;
|
|
8934
|
+
_keyState.tt = 0;
|
|
8935
|
+
}
|
|
8700
8936
|
}, {
|
|
8701
8937
|
key: "handleKeyCode",
|
|
8702
|
-
value: function handleKeyCode(curKeyCode, event) {
|
|
8703
|
-
var
|
|
8704
|
-
|
|
8705
|
-
var
|
|
8706
|
-
if (keyCode === curKeyCode
|
|
8707
|
-
if (
|
|
8708
|
-
action
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8938
|
+
value: function handleKeyCode(curKeyCode, event, isPress) {
|
|
8939
|
+
var arr = Object.keys(this.keyCodeMap);
|
|
8940
|
+
for (var i = 0; i < arr.length; i++) {
|
|
8941
|
+
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;
|
|
8942
|
+
if (keyCode === curKeyCode) {
|
|
8943
|
+
if (!disable && !(isPress && disablePress)) {
|
|
8944
|
+
var _action = !isPress ? action : pressAction || action;
|
|
8945
|
+
if (typeof _action === "function") {
|
|
8946
|
+
action(event, this.player, isPress);
|
|
8947
|
+
} else if (typeof _action === "string") {
|
|
8948
|
+
if (typeof this[_action] === "function") {
|
|
8949
|
+
this[_action](event, this.player, isPress);
|
|
8950
|
+
}
|
|
8712
8951
|
}
|
|
8952
|
+
this.emit(SHORTCUT, _objectSpread2({
|
|
8953
|
+
key: arr[i],
|
|
8954
|
+
target: event.target,
|
|
8955
|
+
isPress
|
|
8956
|
+
}, this.keyCodeMap[arr[i]]));
|
|
8713
8957
|
}
|
|
8714
|
-
|
|
8715
|
-
key,
|
|
8716
|
-
target: event.target
|
|
8717
|
-
}, _this4.keyCodeMap[key]));
|
|
8958
|
+
break;
|
|
8718
8959
|
}
|
|
8719
|
-
}
|
|
8960
|
+
}
|
|
8720
8961
|
}
|
|
8721
8962
|
}, {
|
|
8722
8963
|
key: "destroy",
|
|
8723
8964
|
value: function destroy2() {
|
|
8724
8965
|
this.player.root.removeEventListener("keydown", this.onKeydown);
|
|
8725
8966
|
document.removeEventListener("keydown", this.onBodyKeyDown);
|
|
8967
|
+
this.player.root.removeEventListener("keyup", this.onKeyup);
|
|
8968
|
+
document.removeEventListener("keyup", this.onBodyKeyUp);
|
|
8726
8969
|
}
|
|
8727
8970
|
}, {
|
|
8728
8971
|
key: "disable",
|
|
@@ -8744,12 +8987,13 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8744
8987
|
get: function get() {
|
|
8745
8988
|
return {
|
|
8746
8989
|
seekStep: 10,
|
|
8747
|
-
checkVisible:
|
|
8990
|
+
checkVisible: false,
|
|
8748
8991
|
disableBodyTrigger: false,
|
|
8749
8992
|
disableRootTrigger: false,
|
|
8750
8993
|
isGlobalTrigger: false,
|
|
8751
8994
|
keyCodeMap: {},
|
|
8752
8995
|
disable: false,
|
|
8996
|
+
playbackRate: 2,
|
|
8753
8997
|
isIgnoreUserActive: false
|
|
8754
8998
|
};
|
|
8755
8999
|
}
|
|
@@ -10042,6 +10286,9 @@ class Definition {
|
|
|
10042
10286
|
get url() {
|
|
10043
10287
|
return this._currentUrlRef.url;
|
|
10044
10288
|
}
|
|
10289
|
+
set url(url) {
|
|
10290
|
+
this._currentUrlRef.url = url;
|
|
10291
|
+
}
|
|
10045
10292
|
next() {
|
|
10046
10293
|
const next = this._currentUrlRef.next;
|
|
10047
10294
|
/* istanbul ignore next -- @preserve */
|
|
@@ -10119,7 +10366,6 @@ class SourceManager {
|
|
|
10119
10366
|
__publicField(this, "defaultSource");
|
|
10120
10367
|
__publicField(this, "defaultDefinition");
|
|
10121
10368
|
__publicField(this, "maxFallbackRound");
|
|
10122
|
-
__publicField(this, "_prepareList", []);
|
|
10123
10369
|
__publicField(this, "_currentDefinition");
|
|
10124
10370
|
__publicField(this, "_sources");
|
|
10125
10371
|
__publicField(this, "_fallbackCount", 0);
|
|
@@ -10154,6 +10400,11 @@ class SourceManager {
|
|
|
10154
10400
|
var _a;
|
|
10155
10401
|
return (_a = this.definition) == null ? void 0 : _a.url;
|
|
10156
10402
|
}
|
|
10403
|
+
set url(url) {
|
|
10404
|
+
if (this.definition) {
|
|
10405
|
+
this.definition.url = url;
|
|
10406
|
+
}
|
|
10407
|
+
}
|
|
10157
10408
|
/**
|
|
10158
10409
|
* 以给定的参数搜索源和对应清晰度。`source` 和 `definition`
|
|
10159
10410
|
* 都是可选的,当未指定时,使用当前的 {@link SourceManager.source}
|
|
@@ -10223,14 +10474,6 @@ class SourceManager {
|
|
|
10223
10474
|
this.resetFallback();
|
|
10224
10475
|
return this;
|
|
10225
10476
|
}
|
|
10226
|
-
registerPrepare(prepare) {
|
|
10227
|
-
this._prepareList.push(prepare);
|
|
10228
|
-
}
|
|
10229
|
-
async prepare(url) {
|
|
10230
|
-
for (const prepare of this._prepareList) {
|
|
10231
|
-
await prepare(url);
|
|
10232
|
-
}
|
|
10233
|
-
}
|
|
10234
10477
|
resetFallback() {
|
|
10235
10478
|
this._fallbackCount = 0;
|
|
10236
10479
|
}
|
|
@@ -10672,12 +10915,13 @@ class MobilePlayerPanel {
|
|
|
10672
10915
|
}
|
|
10673
10916
|
}
|
|
10674
10917
|
var optionsIcon = "";
|
|
10675
|
-
|
|
10676
|
-
Middle
|
|
10677
|
-
Bottom
|
|
10678
|
-
Fullscreen
|
|
10679
|
-
Inner
|
|
10680
|
-
|
|
10918
|
+
var ListType = /* @__PURE__ */ ((ListType2) => {
|
|
10919
|
+
ListType2["Middle"] = "middle";
|
|
10920
|
+
ListType2["Bottom"] = "bottom";
|
|
10921
|
+
ListType2["Fullscreen"] = "fullscreen";
|
|
10922
|
+
ListType2["Inner"] = "inner";
|
|
10923
|
+
return ListType2;
|
|
10924
|
+
})(ListType || {});
|
|
10681
10925
|
var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
10682
10926
|
RenderType2["Icon"] = "Icon";
|
|
10683
10927
|
RenderType2["Text"] = "Text";
|
|
@@ -10685,20 +10929,26 @@ var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
|
10685
10929
|
})(RenderType || {});
|
|
10686
10930
|
const isMobile$1 = sniffer.device === "mobile";
|
|
10687
10931
|
const MOBILE_LIST_TYPES = [
|
|
10688
|
-
|
|
10689
|
-
|
|
10690
|
-
|
|
10932
|
+
"bottom",
|
|
10933
|
+
"fullscreen",
|
|
10934
|
+
"inner"
|
|
10935
|
+
/* Inner */
|
|
10936
|
+
];
|
|
10937
|
+
const PC_LIST_TYPES = [
|
|
10938
|
+
"middle"
|
|
10939
|
+
/* Middle */
|
|
10691
10940
|
];
|
|
10692
|
-
const PC_LIST_TYPES = [ListType.Middle];
|
|
10693
10941
|
const MODAL_TYPES = [
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10942
|
+
"bottom",
|
|
10943
|
+
"inner",
|
|
10944
|
+
"fullscreen"
|
|
10945
|
+
/* Fullscreen */
|
|
10697
10946
|
];
|
|
10698
10947
|
const CUSTOM_TYPES = [
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10948
|
+
"bottom",
|
|
10949
|
+
"inner",
|
|
10950
|
+
"fullscreen"
|
|
10951
|
+
/* Fullscreen */
|
|
10702
10952
|
];
|
|
10703
10953
|
class OptionsIcon extends Plugin {
|
|
10704
10954
|
constructor(args) {
|
|
@@ -10736,7 +10986,7 @@ class OptionsIcon extends Plugin {
|
|
|
10736
10986
|
// 默认手机端在“右上角”,pc端在控制栏右侧
|
|
10737
10987
|
position: isMobile$1 ? POSITIONS.ROOT_TOP_RIGHT : POSITIONS.CONTROLS_RIGHT,
|
|
10738
10988
|
// 默认手机端列表展示底部,pc端在控制栏默认
|
|
10739
|
-
listType: isMobile$1 ?
|
|
10989
|
+
listType: isMobile$1 ? "bottom" : "middle",
|
|
10740
10990
|
index: 100,
|
|
10741
10991
|
list: [],
|
|
10742
10992
|
listStyle: {},
|
|
@@ -10918,10 +11168,10 @@ class OptionsIcon extends Plugin {
|
|
|
10918
11168
|
listType = this.player.config.listType;
|
|
10919
11169
|
}
|
|
10920
11170
|
if (!isMobile$1 && (!listType || !MOBILE_LIST_TYPES.includes(listType))) {
|
|
10921
|
-
listType =
|
|
11171
|
+
listType = "bottom";
|
|
10922
11172
|
}
|
|
10923
11173
|
if (!isMobile$1 && (!listType || !PC_LIST_TYPES.includes(listType))) {
|
|
10924
|
-
listType =
|
|
11174
|
+
listType = "middle";
|
|
10925
11175
|
}
|
|
10926
11176
|
return listType;
|
|
10927
11177
|
}
|
|
@@ -11814,9 +12064,7 @@ class DefinitionPlugin extends OptionsIcon {
|
|
|
11814
12064
|
toastPlugin.remove(this._toastId);
|
|
11815
12065
|
}
|
|
11816
12066
|
this._toastId = toastPlugin.toast(
|
|
11817
|
-
`${i18nManager.getText("DEFINITION_SWITCHING")} ${
|
|
11818
|
-
definition.text
|
|
11819
|
-
)) ?? definition.definition} ...`,
|
|
12067
|
+
`${i18nManager.getText("DEFINITION_SWITCHING")} ${definition.showText ?? definition.definition} ...`,
|
|
11820
12068
|
{
|
|
11821
12069
|
duration: 2e3,
|
|
11822
12070
|
closable: true
|
|
@@ -12623,11 +12871,6 @@ class VeI18n {
|
|
|
12623
12871
|
}
|
|
12624
12872
|
}
|
|
12625
12873
|
var veplayerBase = "";
|
|
12626
|
-
var Codec = /* @__PURE__ */ ((Codec2) => {
|
|
12627
|
-
Codec2["H265"] = "h265";
|
|
12628
|
-
Codec2["H264"] = "h264";
|
|
12629
|
-
return Codec2;
|
|
12630
|
-
})(Codec || {});
|
|
12631
12874
|
const { POSITIONS: XGPosition } = Plugin;
|
|
12632
12875
|
const POSITIONS = {
|
|
12633
12876
|
...XGPosition,
|
|
@@ -12637,7 +12880,7 @@ const DEFAULT_OPTIONS = {
|
|
|
12637
12880
|
id: "veplayer",
|
|
12638
12881
|
width: "100%",
|
|
12639
12882
|
height: "100%",
|
|
12640
|
-
decodeType:
|
|
12883
|
+
decodeType: DecodeType.Hardware,
|
|
12641
12884
|
fullscreen: {
|
|
12642
12885
|
useCssFullscreen: false
|
|
12643
12886
|
}
|
|
@@ -12665,6 +12908,9 @@ const transformOption = (options) => {
|
|
|
12665
12908
|
return xgOptions;
|
|
12666
12909
|
};
|
|
12667
12910
|
class VePlayerBase {
|
|
12911
|
+
/**
|
|
12912
|
+
* @hidden
|
|
12913
|
+
*/
|
|
12668
12914
|
constructor(options = {}) {
|
|
12669
12915
|
__publicField(this, "_player");
|
|
12670
12916
|
__publicField(this, "_sourceManager");
|
|
@@ -12712,85 +12958,172 @@ class VePlayerBase {
|
|
|
12712
12958
|
veplayer: this
|
|
12713
12959
|
});
|
|
12714
12960
|
this.emit(Events.PLAYER_CREATE_FINISH, this._player);
|
|
12715
|
-
this._sourceManager.registerPrepare((url) => this.prepare(url));
|
|
12716
12961
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
12717
12962
|
this._player.on(ERROR, this._errorCallback);
|
|
12718
12963
|
}
|
|
12964
|
+
/**
|
|
12965
|
+
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
12966
|
+
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
12967
|
+
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
12968
|
+
* - `2`:HAVE_CURRENT_DATA,当前播放位置的数据可用,但不足以播放下一帧
|
|
12969
|
+
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
12970
|
+
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
12971
|
+
*/
|
|
12719
12972
|
get readyState() {
|
|
12720
12973
|
return this._player.readyState;
|
|
12721
12974
|
}
|
|
12975
|
+
/**
|
|
12976
|
+
* @brief 获取当前已缓冲的时间范围。
|
|
12977
|
+
*/
|
|
12722
12978
|
get buffered() {
|
|
12723
12979
|
return this._player.buffered;
|
|
12724
12980
|
}
|
|
12981
|
+
/**
|
|
12982
|
+
* @brief 获取已经播放的音频/视频的时间范围。
|
|
12983
|
+
*/
|
|
12725
12984
|
get played() {
|
|
12726
12985
|
return this._player.played;
|
|
12727
12986
|
}
|
|
12987
|
+
/**
|
|
12988
|
+
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
12989
|
+
*/
|
|
12728
12990
|
get cumulateTime() {
|
|
12729
12991
|
return this._player.cumulateTime;
|
|
12730
12992
|
}
|
|
12993
|
+
/**
|
|
12994
|
+
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
12995
|
+
*/
|
|
12731
12996
|
get isFocused() {
|
|
12732
12997
|
return this._player.isActive;
|
|
12733
12998
|
}
|
|
12999
|
+
/**
|
|
13000
|
+
* @brief 获取播放器是否处于全屏状态。
|
|
13001
|
+
*/
|
|
12734
13002
|
get isFullscreen() {
|
|
12735
13003
|
return this._player.isFullscreen;
|
|
12736
13004
|
}
|
|
13005
|
+
/**
|
|
13006
|
+
* @brief 获取播放器是否处于网页全屏状态。
|
|
13007
|
+
*/
|
|
12737
13008
|
get isCssFullscreen() {
|
|
12738
13009
|
return this._player.isCssfullScreen;
|
|
12739
13010
|
}
|
|
13011
|
+
/**
|
|
13012
|
+
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
13013
|
+
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
13014
|
+
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
13015
|
+
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
13016
|
+
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
13017
|
+
*/
|
|
12740
13018
|
get networkState() {
|
|
12741
13019
|
return this._player.networkState;
|
|
12742
13020
|
}
|
|
13021
|
+
/**
|
|
13022
|
+
* @brief 获取当前视频是否处于暂停状态。
|
|
13023
|
+
*/
|
|
12743
13024
|
get paused() {
|
|
12744
13025
|
return this._player.paused;
|
|
12745
13026
|
}
|
|
13027
|
+
/**
|
|
13028
|
+
* @brief 获取当前视频是否播放结束。
|
|
13029
|
+
*/
|
|
12746
13030
|
get ended() {
|
|
12747
13031
|
return this._player.ended;
|
|
12748
13032
|
}
|
|
13033
|
+
/**
|
|
13034
|
+
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
13035
|
+
* - `0`:ERROR,播放出现错误
|
|
13036
|
+
* - `1`:INITIAL,初始化
|
|
13037
|
+
* - `2`:READY,配置/事件/插件等均已经初始化/绑定/实例化完成
|
|
13038
|
+
* - `3`:ATTACHING,进入媒体对象挂载阶段
|
|
13039
|
+
* - `4`:ATTACHED,媒体对象已经挂载到了 DOM 中
|
|
13040
|
+
* - `5`:NOTALLOW,播放被阻止
|
|
13041
|
+
* - `6`:RUNNING,已经成功起播进入播放流程
|
|
13042
|
+
* - `7`:ENDED,播放结束
|
|
13043
|
+
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
13044
|
+
*/
|
|
12749
13045
|
get state() {
|
|
12750
13046
|
return this._player.state;
|
|
12751
13047
|
}
|
|
13048
|
+
/**
|
|
13049
|
+
* 获取当前播放视频的拉流地址。
|
|
13050
|
+
*/
|
|
12752
13051
|
get url() {
|
|
12753
13052
|
return this._player.config.url;
|
|
12754
13053
|
}
|
|
13054
|
+
/**
|
|
13055
|
+
* @brief 获取当播放视频的线路名称唯一标识(name)。
|
|
13056
|
+
*/
|
|
12755
13057
|
get source() {
|
|
12756
13058
|
var _a;
|
|
12757
13059
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
12758
13060
|
}
|
|
13061
|
+
/**
|
|
13062
|
+
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13063
|
+
*/
|
|
12759
13064
|
get definition() {
|
|
12760
13065
|
var _a;
|
|
12761
13066
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
12762
13067
|
}
|
|
13068
|
+
/**
|
|
13069
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13070
|
+
*/
|
|
12763
13071
|
get crossOrigin() {
|
|
12764
13072
|
return this._player.crossOrigin;
|
|
12765
13073
|
}
|
|
13074
|
+
/**
|
|
13075
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13076
|
+
*/
|
|
12766
13077
|
set crossOrigin(crossOrigin) {
|
|
12767
13078
|
this._player.crossOrigin = crossOrigin;
|
|
12768
13079
|
}
|
|
13080
|
+
/**
|
|
13081
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13082
|
+
*/
|
|
12769
13083
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12770
13084
|
get volume() {
|
|
12771
13085
|
return this._player.volume;
|
|
12772
13086
|
}
|
|
13087
|
+
/**
|
|
13088
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13089
|
+
*/
|
|
12773
13090
|
set volume(volume) {
|
|
12774
13091
|
this._player.volume = volume;
|
|
12775
13092
|
}
|
|
13093
|
+
/**
|
|
13094
|
+
* @brief 获取和设置视频静音状态。
|
|
13095
|
+
* - `true`:静音
|
|
13096
|
+
* - `false`:非静音
|
|
13097
|
+
*/
|
|
12776
13098
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12777
13099
|
get muted() {
|
|
12778
13100
|
return this._player.muted;
|
|
12779
13101
|
}
|
|
13102
|
+
/**
|
|
13103
|
+
* @brief 获取和设置视频静音状态。
|
|
13104
|
+
* - `true`:静音
|
|
13105
|
+
* - `false`:非静音
|
|
13106
|
+
*/
|
|
12780
13107
|
set muted(isMuted) {
|
|
12781
13108
|
this._player.muted = isMuted;
|
|
12782
13109
|
}
|
|
13110
|
+
/**
|
|
13111
|
+
* @brief 获取和设置当前语言。
|
|
13112
|
+
*/
|
|
12783
13113
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12784
13114
|
get lang() {
|
|
12785
13115
|
return this._i18nManager.getLang();
|
|
12786
13116
|
}
|
|
13117
|
+
/**
|
|
13118
|
+
* @brief 获取和设置当前语言。
|
|
13119
|
+
*/
|
|
12787
13120
|
set lang(lang) {
|
|
12788
13121
|
var _a, _b;
|
|
12789
13122
|
if (this._player.lang === lang) {
|
|
12790
13123
|
return;
|
|
12791
13124
|
}
|
|
12792
13125
|
if (!VeI18n.isLangValid(lang)) {
|
|
12793
|
-
const langKeys = VeI18n.langKeys
|
|
13126
|
+
const langKeys = VeI18n.langKeys.join(",");
|
|
12794
13127
|
const message = {
|
|
12795
13128
|
en: `Sorry, we couldn't set the language to ${lang} because it's not currently supported. The list of supported languages includes ${langKeys}.`,
|
|
12796
13129
|
"zh-cn": `不支持当前设置的语言${lang}, 支持的语言有${langKeys}, 请重新设置`
|
|
@@ -12805,8 +13138,11 @@ class VePlayerBase {
|
|
|
12805
13138
|
get _src() {
|
|
12806
13139
|
return this._player.currentSrc;
|
|
12807
13140
|
}
|
|
13141
|
+
/**
|
|
13142
|
+
* @hidden
|
|
13143
|
+
*/
|
|
12808
13144
|
static async create(options = {}, Constructor) {
|
|
12809
|
-
var _a;
|
|
13145
|
+
var _a, _b, _c;
|
|
12810
13146
|
const sourceManager = new SourceManager({
|
|
12811
13147
|
sources: Source.normalize({
|
|
12812
13148
|
url: options.url,
|
|
@@ -12818,18 +13154,28 @@ class VePlayerBase {
|
|
|
12818
13154
|
defaultDefinition: options.defaultDefinition,
|
|
12819
13155
|
maxFallbackRound: options.maxFallbackRound
|
|
12820
13156
|
});
|
|
13157
|
+
const prepareResult = await ((_a = options == null ? void 0 : options.preparePlugins) == null ? void 0 : _a.call(
|
|
13158
|
+
options,
|
|
13159
|
+
sourceManager.url ?? ""
|
|
13160
|
+
));
|
|
13161
|
+
if ((_b = prepareResult == null ? void 0 : prepareResult.options) == null ? void 0 : _b.url) {
|
|
13162
|
+
sourceManager.url = (_c = prepareResult == null ? void 0 : prepareResult.options) == null ? void 0 : _c.url;
|
|
13163
|
+
}
|
|
12821
13164
|
options.url = sourceManager.url;
|
|
12822
|
-
const prepareResult = await ((_a = options == null ? void 0 : options.preparePlugins) == null ? void 0 : _a.call(options, options.url ?? ""));
|
|
12823
13165
|
return new (Constructor ?? VePlayerBase)({
|
|
12824
13166
|
...options,
|
|
12825
13167
|
prepareResult,
|
|
12826
13168
|
sourceManager
|
|
12827
13169
|
});
|
|
12828
13170
|
}
|
|
13171
|
+
/**
|
|
13172
|
+
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13173
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13174
|
+
* @param options 更多配置信息
|
|
13175
|
+
*/
|
|
12829
13176
|
async switch(target, options) {
|
|
12830
13177
|
var _a, _b;
|
|
12831
13178
|
if (typeof target === "string" && this._sourceManager.sources.length === 1 && ((_b = (_a = this._sourceManager.sources) == null ? void 0 : _a[0].definitions) == null ? void 0 : _b.length) === 1) {
|
|
12832
|
-
this._sourceManager.updateSources(target);
|
|
12833
13179
|
await this._switchUrl(target);
|
|
12834
13180
|
return this._sourceManager.definition;
|
|
12835
13181
|
}
|
|
@@ -12842,12 +13188,22 @@ class VePlayerBase {
|
|
|
12842
13188
|
await this._switch(targetDefinition);
|
|
12843
13189
|
return targetDefinition;
|
|
12844
13190
|
}
|
|
13191
|
+
/**
|
|
13192
|
+
* @brief 调用此方法更新拉流地址列表。
|
|
13193
|
+
* @param playlist 要更新的播放列表。
|
|
13194
|
+
* @param target 更新后默认播放的资源。
|
|
13195
|
+
*/
|
|
12845
13196
|
updatePlaylist(playlist, target) {
|
|
12846
13197
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
12847
13198
|
return this._switch(sourceManager.definition);
|
|
12848
13199
|
}
|
|
12849
13200
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
12850
|
-
|
|
13201
|
+
/**
|
|
13202
|
+
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13203
|
+
* @param event 表示事件的名称。
|
|
13204
|
+
* @param callback 表示事件的名称。
|
|
13205
|
+
*/
|
|
13206
|
+
once(event, callback) {
|
|
12851
13207
|
var _a;
|
|
12852
13208
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
12853
13209
|
if (xgCallback) {
|
|
@@ -12855,27 +13211,45 @@ class VePlayerBase {
|
|
|
12855
13211
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
12856
13212
|
}
|
|
12857
13213
|
this._events[event].set(callback, xgCallback);
|
|
12858
|
-
this._player.once(xgEventName, xgCallback
|
|
13214
|
+
this._player.once(xgEventName, xgCallback);
|
|
12859
13215
|
}
|
|
12860
13216
|
}
|
|
12861
|
-
|
|
13217
|
+
/**
|
|
13218
|
+
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13219
|
+
* @param event 表示事件的名称。
|
|
13220
|
+
* @param callback 表示事件的名称。
|
|
13221
|
+
*/
|
|
13222
|
+
off(event, callback) {
|
|
12862
13223
|
var _a;
|
|
12863
13224
|
const xgCallback = (_a = this._events[event]) == null ? void 0 : _a.get(callback);
|
|
12864
13225
|
const { xgEventName } = this._transformEvent(event);
|
|
12865
13226
|
if (xgCallback) {
|
|
12866
|
-
this._player.off(xgEventName, xgCallback
|
|
13227
|
+
this._player.off(xgEventName, xgCallback);
|
|
12867
13228
|
this._events[event].delete(callback);
|
|
12868
13229
|
}
|
|
12869
13230
|
}
|
|
12870
|
-
|
|
13231
|
+
/**
|
|
13232
|
+
* @brief 调用此方法触发指定事件。
|
|
13233
|
+
* @param event 表示事件的名称。
|
|
13234
|
+
* @param data 事件信息。
|
|
13235
|
+
*/
|
|
13236
|
+
emit(event, data) {
|
|
12871
13237
|
const { xgEventName } = this._transformEvent(event);
|
|
12872
|
-
this._player.emit(xgEventName, data
|
|
13238
|
+
this._player.emit(xgEventName, data);
|
|
12873
13239
|
}
|
|
13240
|
+
/**
|
|
13241
|
+
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13242
|
+
*/
|
|
12874
13243
|
offAll() {
|
|
12875
13244
|
this._events = {};
|
|
12876
13245
|
this._player.offAll();
|
|
12877
13246
|
}
|
|
12878
|
-
|
|
13247
|
+
/**
|
|
13248
|
+
* @brief 调用此方法监听指定事件。
|
|
13249
|
+
* @param event 事件。
|
|
13250
|
+
* @param callback 事件回调。
|
|
13251
|
+
*/
|
|
13252
|
+
on(event, callback) {
|
|
12879
13253
|
var _a;
|
|
12880
13254
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
12881
13255
|
if (xgCallback) {
|
|
@@ -12883,56 +13257,105 @@ class VePlayerBase {
|
|
|
12883
13257
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
12884
13258
|
}
|
|
12885
13259
|
this._events[event].set(callback, xgCallback);
|
|
12886
|
-
this._player.on(xgEventName, xgCallback
|
|
13260
|
+
this._player.on(xgEventName, xgCallback);
|
|
12887
13261
|
}
|
|
12888
13262
|
}
|
|
13263
|
+
/**
|
|
13264
|
+
* @brief 调用此方法开始播放 。
|
|
13265
|
+
*/
|
|
12889
13266
|
play() {
|
|
12890
13267
|
/* istanbul ignore next -- @preserve */
|
|
12891
13268
|
return this._player.play();
|
|
12892
13269
|
}
|
|
13270
|
+
/**
|
|
13271
|
+
* @brief 调用此方法暂停播放。
|
|
13272
|
+
*/
|
|
12893
13273
|
pause() {
|
|
12894
13274
|
/* istanbul ignore next -- @preserve */
|
|
12895
13275
|
return this._player.pause();
|
|
12896
13276
|
}
|
|
13277
|
+
/**
|
|
13278
|
+
* @brief 调用此方法打开画中画。
|
|
13279
|
+
*/
|
|
12897
13280
|
requestPIP() {
|
|
12898
13281
|
var _a;
|
|
12899
13282
|
/* istanbul ignore next -- @preserve */
|
|
12900
13283
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
12901
13284
|
}
|
|
13285
|
+
/**
|
|
13286
|
+
* @brief 调用此方法关闭画中画。
|
|
13287
|
+
*/
|
|
12902
13288
|
exitPIP() {
|
|
12903
13289
|
var _a;
|
|
12904
13290
|
/* istanbul ignore next -- @preserve */
|
|
12905
13291
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
12906
13292
|
}
|
|
13293
|
+
/**
|
|
13294
|
+
* @brief 调用此方法重新拉流。
|
|
13295
|
+
*/
|
|
12907
13296
|
retry() {
|
|
12908
|
-
this._player.emit(Events.RETRY);
|
|
12909
13297
|
return this._player.retry();
|
|
12910
13298
|
}
|
|
13299
|
+
/**
|
|
13300
|
+
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13301
|
+
* @param data 播放器获取焦点配置信息。
|
|
13302
|
+
*/
|
|
12911
13303
|
focus(data) {
|
|
12912
13304
|
return this._player.focus(data);
|
|
12913
13305
|
}
|
|
13306
|
+
/**
|
|
13307
|
+
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13308
|
+
* @param data 播放器失去焦点配置信息。
|
|
13309
|
+
*/
|
|
12914
13310
|
blur(data) {
|
|
12915
13311
|
return this._player.blur(data);
|
|
12916
13312
|
}
|
|
12917
|
-
|
|
13313
|
+
/**
|
|
13314
|
+
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13315
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13316
|
+
*/
|
|
13317
|
+
requestFullscreen(el) {
|
|
12918
13318
|
return this._player.getFullscreen(el);
|
|
12919
13319
|
}
|
|
13320
|
+
/**
|
|
13321
|
+
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13322
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13323
|
+
*/
|
|
12920
13324
|
exitFullscreen(el) {
|
|
12921
13325
|
return this._player.exitFullscreen(el);
|
|
12922
13326
|
}
|
|
12923
|
-
|
|
13327
|
+
/**
|
|
13328
|
+
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13329
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13330
|
+
*/
|
|
13331
|
+
requestCssFullscreen(el) {
|
|
12924
13332
|
return this._player.getCssFullscreen(el);
|
|
12925
13333
|
}
|
|
13334
|
+
/**
|
|
13335
|
+
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13336
|
+
*/
|
|
12926
13337
|
exitCssFullscreen() {
|
|
12927
13338
|
return this._player.exitCssFullscreen();
|
|
12928
13339
|
}
|
|
13340
|
+
/**
|
|
13341
|
+
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13342
|
+
* @param plugin 插件构造函数。
|
|
13343
|
+
* @param config 插件的配置列表。
|
|
13344
|
+
*/
|
|
12929
13345
|
registerPlugin(plugin, config) {
|
|
12930
13346
|
return this._player.registerPlugin(plugin, config);
|
|
12931
13347
|
}
|
|
12932
|
-
|
|
12933
|
-
|
|
13348
|
+
/**
|
|
13349
|
+
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13350
|
+
* @param plugin 插件实例或者插件名称。
|
|
13351
|
+
*/
|
|
13352
|
+
unRegisterPlugin(plugin) {
|
|
13353
|
+
return this._player.unRegisterPlugin(plugin);
|
|
12934
13354
|
}
|
|
12935
|
-
|
|
13355
|
+
/**
|
|
13356
|
+
* @brief 调用此接口显示指定插件图标。
|
|
13357
|
+
* @param pluginNames 插件名称
|
|
13358
|
+
*/
|
|
12936
13359
|
showIcon(pluginNames) {
|
|
12937
13360
|
const morePlugin = this._player.getPlugin("more");
|
|
12938
13361
|
pluginNames.forEach((pluginName) => {
|
|
@@ -12946,7 +13369,10 @@ class VePlayerBase {
|
|
|
12946
13369
|
}
|
|
12947
13370
|
});
|
|
12948
13371
|
}
|
|
12949
|
-
|
|
13372
|
+
/**
|
|
13373
|
+
* @brief 调用此接口隐藏指定插件图标。
|
|
13374
|
+
* @param pluginNames 插件名称
|
|
13375
|
+
*/
|
|
12950
13376
|
hideIcon(pluginNames) {
|
|
12951
13377
|
const morePlugin = this._player.getPlugin("more");
|
|
12952
13378
|
pluginNames.forEach((pluginName) => {
|
|
@@ -12960,10 +13386,16 @@ class VePlayerBase {
|
|
|
12960
13386
|
}
|
|
12961
13387
|
});
|
|
12962
13388
|
}
|
|
13389
|
+
/**
|
|
13390
|
+
* @brief 调用此方法销毁播放器实例。
|
|
13391
|
+
*/
|
|
12963
13392
|
destroy() {
|
|
12964
13393
|
this._player.off(ERROR, this._errorCallback);
|
|
12965
13394
|
this._player.destroy();
|
|
12966
13395
|
}
|
|
13396
|
+
/**
|
|
13397
|
+
* @hidden
|
|
13398
|
+
*/
|
|
12967
13399
|
async prepare(url) {
|
|
12968
13400
|
var _a, _b;
|
|
12969
13401
|
const result = await ((_a = this._preparePlugins) == null ? void 0 : _a.call(this, url));
|
|
@@ -12979,9 +13411,12 @@ class VePlayerBase {
|
|
|
12979
13411
|
if (result == null ? void 0 : result.options) {
|
|
12980
13412
|
this._player.setConfig(result.options);
|
|
12981
13413
|
}
|
|
12982
|
-
return
|
|
12983
|
-
|
|
12984
|
-
|
|
13414
|
+
return {
|
|
13415
|
+
plugins: addedPlugins.map((plugin) => {
|
|
13416
|
+
return this._player.registerPlugin(plugin);
|
|
13417
|
+
}),
|
|
13418
|
+
options: result == null ? void 0 : result.options
|
|
13419
|
+
};
|
|
12985
13420
|
}
|
|
12986
13421
|
async _handleFallback(err) {
|
|
12987
13422
|
this._player.addClass(STATE_CLASS.ENTER);
|
|
@@ -13016,7 +13451,10 @@ class VePlayerBase {
|
|
|
13016
13451
|
async _switch(targetDefinition) {
|
|
13017
13452
|
var _a, _b, _c, _d, _e, _f;
|
|
13018
13453
|
const preDefinition = clonedeep(this._sourceManager.definition);
|
|
13019
|
-
const newPlugins = await this.prepare(targetDefinition.url);
|
|
13454
|
+
const { plugins: newPlugins, options } = await this.prepare(targetDefinition.url) || {};
|
|
13455
|
+
if (options == null ? void 0 : options.url) {
|
|
13456
|
+
targetDefinition.url = options == null ? void 0 : options.url;
|
|
13457
|
+
}
|
|
13020
13458
|
this._sourceManager.switch(targetDefinition);
|
|
13021
13459
|
(_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
|
|
13022
13460
|
(_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
|
|
@@ -13032,11 +13470,13 @@ class VePlayerBase {
|
|
|
13032
13470
|
}
|
|
13033
13471
|
}
|
|
13034
13472
|
async _switchUrl(url) {
|
|
13035
|
-
const newPlugins = await this.prepare(url);
|
|
13473
|
+
const { plugins: newPlugins, options } = await this.prepare(url) || {};
|
|
13474
|
+
const newUrl = (options == null ? void 0 : options.url) ?? url;
|
|
13475
|
+
this._sourceManager.updateSources(newUrl);
|
|
13036
13476
|
if (newPlugins == null ? void 0 : newPlugins.length) {
|
|
13037
|
-
this._callBeforePlayerInitForUrl(newPlugins,
|
|
13477
|
+
this._callBeforePlayerInitForUrl(newPlugins, newUrl);
|
|
13038
13478
|
} else {
|
|
13039
|
-
const res = this._player.switchURL(
|
|
13479
|
+
const res = this._player.switchURL(newUrl, false);
|
|
13040
13480
|
const curTime = this._player.currentTime;
|
|
13041
13481
|
if (res && res.then) {
|
|
13042
13482
|
return res;
|