@volcengine/veplayer 2.0.0-rc.2 → 2.1.0-rc.1
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 +17 -11
- package/esm/veplayer.biz.live.development.js +184 -45
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +53 -28
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +600 -234
- package/esm/veplayer.live.d.ts +53 -28
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +600 -234
- 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 +17 -11
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +402 -173
- 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 +17 -11
- package/umd/veplayer.biz.live.development.js +184 -45
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +53 -28
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +600 -234
- package/umd/veplayer.live.d.ts +53 -28
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +598 -232
- 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 +17 -11
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +402 -173
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
|
@@ -1014,6 +1014,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1014
1014
|
}
|
|
1015
1015
|
return /^blob/.test(video.currentSrc) || /^blob/.test(video.src);
|
|
1016
1016
|
};
|
|
1017
|
+
util.isBlob = function(url) {
|
|
1018
|
+
return /^blob/.test(url);
|
|
1019
|
+
};
|
|
1017
1020
|
util.generateSessionId = function() {
|
|
1018
1021
|
var did = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
1019
1022
|
var d = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -1074,6 +1077,69 @@ var __publicField = (obj, key, value) => {
|
|
|
1074
1077
|
}
|
|
1075
1078
|
return val % 360;
|
|
1076
1079
|
};
|
|
1080
|
+
util.getIndexByTime = function(time, segments) {
|
|
1081
|
+
var _len = segments.length;
|
|
1082
|
+
var _index = -1;
|
|
1083
|
+
if (_len < 1) {
|
|
1084
|
+
return _index;
|
|
1085
|
+
}
|
|
1086
|
+
if (time <= segments[0].end || _len < 2) {
|
|
1087
|
+
_index = 0;
|
|
1088
|
+
} else if (time > segments[_len - 1].end) {
|
|
1089
|
+
_index = _len - 1;
|
|
1090
|
+
} else {
|
|
1091
|
+
for (var i = 1; i < _len; i++) {
|
|
1092
|
+
if (time > segments[i - 1].end && time <= segments[i].end) {
|
|
1093
|
+
_index = i;
|
|
1094
|
+
break;
|
|
1095
|
+
}
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
return _index;
|
|
1099
|
+
};
|
|
1100
|
+
util.getOffsetCurrentTime = function(currentTime, segments) {
|
|
1101
|
+
var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1;
|
|
1102
|
+
var _index = -1;
|
|
1103
|
+
if (index >= 0 && index < segments.length) {
|
|
1104
|
+
_index = index;
|
|
1105
|
+
} else {
|
|
1106
|
+
_index = util.getIndexByTime(currentTime, segments);
|
|
1107
|
+
}
|
|
1108
|
+
if (_index < 0) {
|
|
1109
|
+
return -1;
|
|
1110
|
+
}
|
|
1111
|
+
var _len = segments.length;
|
|
1112
|
+
var _segments$_index = segments[_index], start = _segments$_index.start, end = _segments$_index.end, cTime = _segments$_index.cTime, offset = _segments$_index.offset;
|
|
1113
|
+
if (currentTime < start) {
|
|
1114
|
+
return cTime;
|
|
1115
|
+
} else if (currentTime >= start && currentTime <= end) {
|
|
1116
|
+
return currentTime - offset;
|
|
1117
|
+
} else if (currentTime > end && _index >= _len - 1) {
|
|
1118
|
+
return end;
|
|
1119
|
+
}
|
|
1120
|
+
return -1;
|
|
1121
|
+
};
|
|
1122
|
+
util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
1123
|
+
var _index = -1;
|
|
1124
|
+
if (!segments || segments.length < 0) {
|
|
1125
|
+
return offsetTime;
|
|
1126
|
+
}
|
|
1127
|
+
for (var i = 0; i < segments.length; i++) {
|
|
1128
|
+
if (offsetTime <= segments[i].duration) {
|
|
1129
|
+
_index = i;
|
|
1130
|
+
break;
|
|
1131
|
+
}
|
|
1132
|
+
}
|
|
1133
|
+
if (_index !== -1) {
|
|
1134
|
+
var start = segments[_index].start;
|
|
1135
|
+
if (_index - 1 < 0) {
|
|
1136
|
+
return start + offsetTime;
|
|
1137
|
+
} else {
|
|
1138
|
+
return start + (offsetTime - segments[_index - 1].duration);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
return offsetTime;
|
|
1142
|
+
};
|
|
1077
1143
|
function isObject(value) {
|
|
1078
1144
|
var type = _typeof(value);
|
|
1079
1145
|
return value !== null && (type === "object" || type === "function");
|
|
@@ -1163,7 +1229,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1163
1229
|
function debounced() {
|
|
1164
1230
|
var time = Date.now();
|
|
1165
1231
|
var isInvoking = shouldInvoke(time);
|
|
1166
|
-
for (var
|
|
1232
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
|
|
1167
1233
|
args[_key] = arguments[_key];
|
|
1168
1234
|
}
|
|
1169
1235
|
lastArgs = args;
|
|
@@ -1370,7 +1436,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1370
1436
|
}
|
|
1371
1437
|
}
|
|
1372
1438
|
};
|
|
1373
|
-
var version = "3.0.
|
|
1439
|
+
var version = "3.0.10-alpha.4";
|
|
1374
1440
|
var ERROR_TYPE_MAP = {
|
|
1375
1441
|
1: "media",
|
|
1376
1442
|
2: "media",
|
|
@@ -1456,6 +1522,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1456
1522
|
var DURATION_CHANGE = "durationchange";
|
|
1457
1523
|
var VOLUME_CHANGE = "volumechange";
|
|
1458
1524
|
var LOADED_DATA = "loadeddata";
|
|
1525
|
+
var LOADED_METADATA = "loadedmetadata";
|
|
1459
1526
|
var RATE_CHANGE = "ratechange";
|
|
1460
1527
|
var PROGRESS = "progress";
|
|
1461
1528
|
var LOAD_START = "loadstart";
|
|
@@ -1495,7 +1562,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1495
1562
|
var SOURCE_ERROR = "source_error";
|
|
1496
1563
|
var SOURCE_SUCCESS = "source_success";
|
|
1497
1564
|
var SWITCH_SUBTITLE = "switch_subtitle";
|
|
1498
|
-
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"];
|
|
1565
|
+
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"];
|
|
1499
1566
|
var STATS_EVENTS = {
|
|
1500
1567
|
STATS_INFO: "stats_info",
|
|
1501
1568
|
STATS_DOWNLOAD: "stats_download",
|
|
@@ -1524,6 +1591,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1524
1591
|
FPS_STUCK,
|
|
1525
1592
|
FULLSCREEN_CHANGE,
|
|
1526
1593
|
LOADED_DATA,
|
|
1594
|
+
LOADED_METADATA,
|
|
1527
1595
|
LOAD_START,
|
|
1528
1596
|
MINI_STATE_CHANGE,
|
|
1529
1597
|
PAUSE,
|
|
@@ -1661,6 +1729,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1661
1729
|
if (options.loop) {
|
|
1662
1730
|
_this.mediaConfig.loop = "loop";
|
|
1663
1731
|
}
|
|
1732
|
+
if (options.autoplayMuted && !Object.prototype.hasOwnProperty.call(_this.mediaConfig, "muted")) {
|
|
1733
|
+
_this.mediaConfig.muted = true;
|
|
1734
|
+
}
|
|
1664
1735
|
_this.media = util.createDom(_this.mediaConfig.mediaType, "", _this.mediaConfig, "");
|
|
1665
1736
|
if (options.defaultPlaybackRate) {
|
|
1666
1737
|
_this.media.defaultPlaybackRate = _this.media.playbackRate = options.defaultPlaybackRate;
|
|
@@ -1739,10 +1810,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1739
1810
|
var _this6 = this;
|
|
1740
1811
|
video.removeAttribute("src");
|
|
1741
1812
|
video.load();
|
|
1742
|
-
urls.forEach(function(item) {
|
|
1813
|
+
urls.forEach(function(item, index) {
|
|
1743
1814
|
_this6.media.appendChild(util.createDom("source", "", {
|
|
1744
1815
|
src: "".concat(item.src),
|
|
1745
|
-
type: "".concat(item.type || "")
|
|
1816
|
+
type: "".concat(item.type || ""),
|
|
1817
|
+
"data-index": index + 1
|
|
1746
1818
|
}));
|
|
1747
1819
|
});
|
|
1748
1820
|
var _c = video.children;
|
|
@@ -1750,6 +1822,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1750
1822
|
return;
|
|
1751
1823
|
}
|
|
1752
1824
|
this._videoSourceCount = _c.length;
|
|
1825
|
+
this._videoSourceIndex = _c.length;
|
|
1753
1826
|
this._vLoadeddata = function(e) {
|
|
1754
1827
|
_this6.emit(SOURCE_SUCCESS, {
|
|
1755
1828
|
src: e.target.currentSrc,
|
|
@@ -1764,8 +1837,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1764
1837
|
}
|
|
1765
1838
|
}
|
|
1766
1839
|
!this._sourceError && (this._sourceError = function(e) {
|
|
1767
|
-
|
|
1768
|
-
|
|
1840
|
+
var _dIndex = parseInt(e.target.getAttribute("data-index"), 10);
|
|
1841
|
+
_this6._videoSourceIndex--;
|
|
1842
|
+
if (_this6._videoSourceIndex === 0 || _dIndex >= _this6._videoSourceCount) {
|
|
1769
1843
|
var _err = {
|
|
1770
1844
|
code: 4,
|
|
1771
1845
|
message: "sources_load_error"
|
|
@@ -2092,7 +2166,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2092
2166
|
this.emit(WAITING);
|
|
2093
2167
|
this._currentTime = 0;
|
|
2094
2168
|
this._duration = 0;
|
|
2095
|
-
if (
|
|
2169
|
+
if (util.isMSE(this.media)) {
|
|
2096
2170
|
this.onWaiting();
|
|
2097
2171
|
return;
|
|
2098
2172
|
}
|
|
@@ -3800,6 +3874,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3800
3874
|
},
|
|
3801
3875
|
enableSwipeHandler: function enableSwipeHandler() {
|
|
3802
3876
|
},
|
|
3877
|
+
preProcessUrl: null,
|
|
3803
3878
|
ignores: [],
|
|
3804
3879
|
whitelist: [],
|
|
3805
3880
|
inactive: 3e3,
|
|
@@ -3881,7 +3956,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3881
3956
|
autoHide: false
|
|
3882
3957
|
});
|
|
3883
3958
|
});
|
|
3884
|
-
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function() {
|
|
3959
|
+
_defineProperty(_assertThisInitialized(_this), "onMouseLeave", function(e) {
|
|
3885
3960
|
var _assertThisInitialize2 = _assertThisInitialized(_this), player = _assertThisInitialize2.player;
|
|
3886
3961
|
player.focus();
|
|
3887
3962
|
});
|
|
@@ -3959,12 +4034,13 @@ var __publicField = (obj, key, value) => {
|
|
|
3959
4034
|
}, {
|
|
3960
4035
|
key: "show",
|
|
3961
4036
|
value: function show() {
|
|
3962
|
-
|
|
4037
|
+
this.root.style.display = "";
|
|
4038
|
+
this.player.focus();
|
|
3963
4039
|
}
|
|
3964
4040
|
}, {
|
|
3965
4041
|
key: "hide",
|
|
3966
4042
|
value: function hide() {
|
|
3967
|
-
|
|
4043
|
+
this.root.style.display = "none";
|
|
3968
4044
|
}
|
|
3969
4045
|
}, {
|
|
3970
4046
|
key: "mode",
|
|
@@ -4366,6 +4442,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4366
4442
|
_this.cssfullscreen = false;
|
|
4367
4443
|
_this.isRotateFullscreen = false;
|
|
4368
4444
|
_this._fullscreenEl = null;
|
|
4445
|
+
_this.timeSegments = [];
|
|
4369
4446
|
_this._cssfullscreenEl = null;
|
|
4370
4447
|
_this.curDefinition = null;
|
|
4371
4448
|
_this._orgCss = "";
|
|
@@ -4375,7 +4452,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4375
4452
|
_this.videoPos = {
|
|
4376
4453
|
pi: 1,
|
|
4377
4454
|
scale: 0,
|
|
4378
|
-
rotate:
|
|
4455
|
+
rotate: -1,
|
|
4379
4456
|
x: 0,
|
|
4380
4457
|
y: 0,
|
|
4381
4458
|
h: -1,
|
|
@@ -4383,11 +4460,21 @@ var __publicField = (obj, key, value) => {
|
|
|
4383
4460
|
vy: 0,
|
|
4384
4461
|
vx: 0
|
|
4385
4462
|
};
|
|
4463
|
+
_this.sizeInfo = {
|
|
4464
|
+
width: 0,
|
|
4465
|
+
height: 0,
|
|
4466
|
+
left: 0,
|
|
4467
|
+
top: 0
|
|
4468
|
+
};
|
|
4386
4469
|
_this._accPlayed = {
|
|
4387
4470
|
t: 0,
|
|
4388
4471
|
acc: 0,
|
|
4389
4472
|
loopAcc: 0
|
|
4390
4473
|
};
|
|
4474
|
+
_this._offsetInfo = {
|
|
4475
|
+
currentTime: -1,
|
|
4476
|
+
duration: 0
|
|
4477
|
+
};
|
|
4391
4478
|
_this.innerContainer = null;
|
|
4392
4479
|
_this.controls = null;
|
|
4393
4480
|
_this.topBar = null;
|
|
@@ -4400,6 +4487,9 @@ var __publicField = (obj, key, value) => {
|
|
|
4400
4487
|
_this.isUserActive = false;
|
|
4401
4488
|
_this._onceSeekCanplay = null;
|
|
4402
4489
|
_this._isPauseBeforeSeek = 0;
|
|
4490
|
+
_this.innerStates = {
|
|
4491
|
+
isActiveLocked: false
|
|
4492
|
+
};
|
|
4403
4493
|
var rootInit = _this._initDOM();
|
|
4404
4494
|
if (!rootInit) {
|
|
4405
4495
|
console.error(new Error("can't find the dom which id is ".concat(_this.config.id, " or this.config.el does not exist")));
|
|
@@ -4485,16 +4575,16 @@ var __publicField = (obj, key, value) => {
|
|
|
4485
4575
|
this.addClass(STATE_CLASS.NO_START);
|
|
4486
4576
|
}
|
|
4487
4577
|
if (this.config.fluid) {
|
|
4488
|
-
var _this$config3 = this.config,
|
|
4489
|
-
if (typeof
|
|
4490
|
-
|
|
4491
|
-
|
|
4578
|
+
var _this$config3 = this.config, _width = _this$config3.width, _height = _this$config3.height;
|
|
4579
|
+
if (typeof _width !== "number" || typeof _height !== "number") {
|
|
4580
|
+
_width = 600;
|
|
4581
|
+
_height = 337.5;
|
|
4492
4582
|
}
|
|
4493
4583
|
var style = {
|
|
4494
4584
|
width: "100%",
|
|
4495
4585
|
height: "0",
|
|
4496
4586
|
"max-width": "100%",
|
|
4497
|
-
"padding-top": "".concat(
|
|
4587
|
+
"padding-top": "".concat(_height * 100 / _width, "%")
|
|
4498
4588
|
};
|
|
4499
4589
|
Object.keys(style).forEach(function(key) {
|
|
4500
4590
|
_this2.root.style[key] = style[key];
|
|
@@ -4510,6 +4600,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4510
4600
|
}
|
|
4511
4601
|
});
|
|
4512
4602
|
}
|
|
4603
|
+
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;
|
|
4604
|
+
this.sizeInfo.width = width;
|
|
4605
|
+
this.sizeInfo.height = height;
|
|
4606
|
+
this.sizeInfo.left = left;
|
|
4607
|
+
this.sizeInfo.top = top;
|
|
4513
4608
|
return true;
|
|
4514
4609
|
}
|
|
4515
4610
|
}, {
|
|
@@ -4593,7 +4688,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4593
4688
|
var readyState = this.media.readyState;
|
|
4594
4689
|
XG_DEBUG.logInfo("_startInit readyState", readyState);
|
|
4595
4690
|
if (this.config.autoplay) {
|
|
4596
|
-
!
|
|
4691
|
+
!util.isMSE(this.media) && this.load();
|
|
4597
4692
|
(sniffer.os.isIpad || sniffer.os.isPhone) && this.mediaPlay();
|
|
4598
4693
|
}
|
|
4599
4694
|
if (readyState >= 2) {
|
|
@@ -4821,7 +4916,8 @@ var __publicField = (obj, key, value) => {
|
|
|
4821
4916
|
if (!url) {
|
|
4822
4917
|
url = _this8.url || _this8.config.url;
|
|
4823
4918
|
}
|
|
4824
|
-
var
|
|
4919
|
+
var _furl = _this8.preProcessUrl(url);
|
|
4920
|
+
var ret = _this8._startInit(_furl.url);
|
|
4825
4921
|
return ret;
|
|
4826
4922
|
}).catch(function(e) {
|
|
4827
4923
|
e.fileName = "player";
|
|
@@ -4838,6 +4934,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4838
4934
|
if (util.typeOf(url) === "Object") {
|
|
4839
4935
|
_src = url.url;
|
|
4840
4936
|
}
|
|
4937
|
+
_src = this.preProcessUrl(_src).url;
|
|
4841
4938
|
var curTime = this.currentTime;
|
|
4842
4939
|
var isPaused = this.paused && !this.isError;
|
|
4843
4940
|
this.src = _src;
|
|
@@ -5176,7 +5273,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5176
5273
|
this.addClass(STATE_CLASS.LOADING);
|
|
5177
5274
|
runHooks(this, "retry", function() {
|
|
5178
5275
|
var cur = _this20.currentTime;
|
|
5179
|
-
|
|
5276
|
+
var url = _this20.config.url;
|
|
5277
|
+
var _srcRet = !util.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
|
|
5278
|
+
url
|
|
5279
|
+
};
|
|
5280
|
+
_this20.src = _srcRet.url;
|
|
5180
5281
|
!_this20.config.isLive && (_this20.currentTime = cur);
|
|
5181
5282
|
_this20.once(CANPLAY, function() {
|
|
5182
5283
|
_this20.mediaPlay();
|
|
@@ -5237,7 +5338,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5237
5338
|
var fullEl = util.getFullScreenEl();
|
|
5238
5339
|
if (fullEl === this._fullscreenEl) {
|
|
5239
5340
|
this.onFullscreenChange();
|
|
5240
|
-
return;
|
|
5341
|
+
return Promise.resolve();
|
|
5241
5342
|
}
|
|
5242
5343
|
try {
|
|
5243
5344
|
for (var i = 0; i < GET_FULLSCREEN_API.length; i++) {
|
|
@@ -5410,30 +5511,38 @@ var __publicField = (obj, key, value) => {
|
|
|
5410
5511
|
key: "onFocus",
|
|
5411
5512
|
value: function onFocus() {
|
|
5412
5513
|
var _this21 = this;
|
|
5413
|
-
var
|
|
5514
|
+
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
5515
|
+
autoHide: true,
|
|
5516
|
+
delay: 3e3
|
|
5517
|
+
};
|
|
5518
|
+
var innerStates = this.innerStates;
|
|
5414
5519
|
this.isActive = true;
|
|
5415
5520
|
this.removeClass(STATE_CLASS.INACTIVE);
|
|
5416
5521
|
if (this.userTimer) {
|
|
5417
5522
|
util.clearTimeout(this, this.userTimer);
|
|
5418
5523
|
this.userTimer = null;
|
|
5419
5524
|
}
|
|
5420
|
-
if (
|
|
5525
|
+
if (data.isLock !== void 0) {
|
|
5526
|
+
innerStates.isActiveLocked = data.isLock;
|
|
5527
|
+
}
|
|
5528
|
+
if (data.autoHide === false || data.isLock === true || innerStates.isActiveLocked) {
|
|
5421
5529
|
if (this.userTimer) {
|
|
5422
5530
|
util.clearTimeout(this, this.userTimer);
|
|
5423
5531
|
this.userTimer = null;
|
|
5424
5532
|
}
|
|
5425
5533
|
return;
|
|
5426
5534
|
}
|
|
5535
|
+
var time = data && data.delay ? data.delay : this.config.inactive;
|
|
5427
5536
|
this.userTimer = util.setTimeout(this, function() {
|
|
5428
5537
|
_this21.userTimer = null;
|
|
5429
5538
|
_this21.blur();
|
|
5430
|
-
},
|
|
5539
|
+
}, time);
|
|
5431
5540
|
}
|
|
5432
5541
|
}, {
|
|
5433
5542
|
key: "onBlur",
|
|
5434
5543
|
value: function onBlur() {
|
|
5435
|
-
var
|
|
5436
|
-
if (!this.isActive) {
|
|
5544
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$ignorePaused = _ref.ignorePaused, ignorePaused = _ref$ignorePaused === void 0 ? false : _ref$ignorePaused;
|
|
5545
|
+
if (!this.isActive || this.innerStates.isActiveLocked) {
|
|
5437
5546
|
return;
|
|
5438
5547
|
}
|
|
5439
5548
|
var closePauseVideoFocus = this.config.closePauseVideoFocus;
|
|
@@ -5556,7 +5665,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5556
5665
|
}, {
|
|
5557
5666
|
key: "onTimeupdate",
|
|
5558
5667
|
value: function onTimeupdate() {
|
|
5559
|
-
!this._videoHeight && this.resize();
|
|
5668
|
+
!this._videoHeight && this.media.videoHeight && this.resize();
|
|
5560
5669
|
if ((this.waitTimer || this.hasClass(STATE_CLASS.LOADING)) && this.media.readyState > 2) {
|
|
5561
5670
|
this.removeClass(STATE_CLASS.LOADING);
|
|
5562
5671
|
util.clearTimeout(this, this.waitTimer);
|
|
@@ -5631,8 +5740,11 @@ var __publicField = (obj, key, value) => {
|
|
|
5631
5740
|
key: "resizePosition",
|
|
5632
5741
|
value: function resizePosition() {
|
|
5633
5742
|
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;
|
|
5743
|
+
if (rotate < 0 && !vy && !vx) {
|
|
5744
|
+
return;
|
|
5745
|
+
}
|
|
5634
5746
|
var _pi = this.videoPos._pi;
|
|
5635
|
-
if (!_pi) {
|
|
5747
|
+
if (!_pi && this.media.videoHeight) {
|
|
5636
5748
|
_pi = this.media.videoWidth / this.media.videoHeight * 100;
|
|
5637
5749
|
}
|
|
5638
5750
|
if (!_pi) {
|
|
@@ -5732,9 +5844,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5732
5844
|
if (!this.media) {
|
|
5733
5845
|
return;
|
|
5734
5846
|
}
|
|
5847
|
+
var containerSize = this.root.getBoundingClientRect();
|
|
5848
|
+
this.sizeInfo.width = containerSize.width;
|
|
5849
|
+
this.sizeInfo.height = containerSize.height;
|
|
5850
|
+
this.sizeInfo.left = containerSize.left;
|
|
5851
|
+
this.sizeInfo.top = containerSize.top;
|
|
5735
5852
|
var _this$media = this.media, videoWidth = _this$media.videoWidth, videoHeight = _this$media.videoHeight;
|
|
5736
5853
|
var _this$config6 = this.config, fitVideoSize = _this$config6.fitVideoSize, videoFillMode = _this$config6.videoFillMode;
|
|
5737
|
-
if (videoFillMode === "fill" || videoFillMode === "cover") {
|
|
5854
|
+
if (videoFillMode === "fill" || videoFillMode === "cover" || videoFillMode === "contain") {
|
|
5738
5855
|
this.setAttribute("data-xgfill", videoFillMode);
|
|
5739
5856
|
}
|
|
5740
5857
|
if (!videoHeight || !videoWidth) {
|
|
@@ -5742,7 +5859,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5742
5859
|
}
|
|
5743
5860
|
this._videoHeight = videoHeight;
|
|
5744
5861
|
this._videoWidth = videoWidth;
|
|
5745
|
-
var containerSize = this.root.getBoundingClientRect();
|
|
5746
5862
|
var controlsHeight = this.controls && this.innerContainer ? this.controls.root.getBoundingClientRect().height : 0;
|
|
5747
5863
|
var width = containerSize.width;
|
|
5748
5864
|
var height = containerSize.height - controlsHeight;
|
|
@@ -5797,6 +5913,14 @@ var __publicField = (obj, key, value) => {
|
|
|
5797
5913
|
XG_DEBUG.logInfo("setState", "state from:".concat(STATE_ARRAY[this.state], " to:").concat(STATE_ARRAY[newState]));
|
|
5798
5914
|
this._state = newState;
|
|
5799
5915
|
}
|
|
5916
|
+
}, {
|
|
5917
|
+
key: "preProcessUrl",
|
|
5918
|
+
value: function preProcessUrl(url, ext) {
|
|
5919
|
+
var preProcessUrl2 = this.config.preProcessUrl;
|
|
5920
|
+
return !util.isBlob(url) && preProcessUrl2 && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, ext) : {
|
|
5921
|
+
url
|
|
5922
|
+
};
|
|
5923
|
+
}
|
|
5800
5924
|
}, {
|
|
5801
5925
|
key: "state",
|
|
5802
5926
|
get: function get() {
|
|
@@ -5970,9 +6094,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5970
6094
|
}, {
|
|
5971
6095
|
key: "cumulateTime",
|
|
5972
6096
|
get: function get() {
|
|
5973
|
-
var _accPlayed = this._accPlayed;
|
|
5974
|
-
|
|
5975
|
-
return _accPlayed.acc;
|
|
6097
|
+
var _this$_accPlayed = this._accPlayed, acc = _this$_accPlayed.acc, t = _this$_accPlayed.t;
|
|
6098
|
+
return t ? (/* @__PURE__ */ new Date()).getTime() - t + acc : acc;
|
|
5976
6099
|
}
|
|
5977
6100
|
}, {
|
|
5978
6101
|
key: "zoom",
|
|
@@ -6011,6 +6134,22 @@ var __publicField = (obj, key, value) => {
|
|
|
6011
6134
|
set: function set(val) {
|
|
6012
6135
|
REAL_TIME_SPEED = val;
|
|
6013
6136
|
}
|
|
6137
|
+
}, {
|
|
6138
|
+
key: "offsetCurrentTime",
|
|
6139
|
+
get: function get() {
|
|
6140
|
+
return this._offsetInfo.currentTime || 0;
|
|
6141
|
+
},
|
|
6142
|
+
set: function set(val) {
|
|
6143
|
+
this._offsetInfo.currentTime = val;
|
|
6144
|
+
}
|
|
6145
|
+
}, {
|
|
6146
|
+
key: "offsetDuration",
|
|
6147
|
+
get: function get() {
|
|
6148
|
+
return this._offsetInfo.duration || 0;
|
|
6149
|
+
},
|
|
6150
|
+
set: function set(val) {
|
|
6151
|
+
this._offsetInfo.duration = val || 0;
|
|
6152
|
+
}
|
|
6014
6153
|
}, {
|
|
6015
6154
|
key: "hook",
|
|
6016
6155
|
value: function hook$1(hookName, handler) {
|
|
@@ -7656,10 +7795,56 @@ var __publicField = (obj, key, value) => {
|
|
|
7656
7795
|
var Touche = /* @__PURE__ */ function() {
|
|
7657
7796
|
function Touche2(dom) {
|
|
7658
7797
|
var _this = this;
|
|
7659
|
-
var
|
|
7798
|
+
var _config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7660
7799
|
eventType: "touch"
|
|
7661
7800
|
};
|
|
7662
7801
|
_classCallCheck(this, Touche2);
|
|
7802
|
+
_defineProperty(this, "onTouchStart", function(e) {
|
|
7803
|
+
var _pos = _this._pos, root = _this.root;
|
|
7804
|
+
var touch = getTouch(e.touches);
|
|
7805
|
+
_pos.x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7806
|
+
_pos.y = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7807
|
+
_pos.start = true;
|
|
7808
|
+
_this.__setPress(e);
|
|
7809
|
+
root.addEventListener(_this.events.end, _this.onTouchEnd);
|
|
7810
|
+
root.addEventListener(_this.events.cancel, _this.onTouchCancel);
|
|
7811
|
+
root.addEventListener(_this.events.move, _this.onTouchMove);
|
|
7812
|
+
_this.trigger(EVENTS.TOUCH_START, e);
|
|
7813
|
+
});
|
|
7814
|
+
_defineProperty(this, "onTouchCancel", function(e) {
|
|
7815
|
+
_this.onTouchEnd(e);
|
|
7816
|
+
});
|
|
7817
|
+
_defineProperty(this, "onTouchEnd", function(e) {
|
|
7818
|
+
var _pos = _this._pos, root = _this.root;
|
|
7819
|
+
_this.__clearPress();
|
|
7820
|
+
root.removeEventListener(_this.events.cancel, _this.onTouchCancel);
|
|
7821
|
+
root.removeEventListener(_this.events.end, _this.onTouchEnd);
|
|
7822
|
+
root.removeEventListener(_this.events.move, _this.onTouchMove);
|
|
7823
|
+
e.moving = _pos.moving;
|
|
7824
|
+
e.press = _pos.press;
|
|
7825
|
+
_pos.press && _this.trigger(EVENTS.PRESS_END, e);
|
|
7826
|
+
_this.trigger(EVENTS.TOUCH_END, e);
|
|
7827
|
+
!_pos.press && !_pos.moving && _this.__setDb(e);
|
|
7828
|
+
_pos.press = false;
|
|
7829
|
+
_pos.start = false;
|
|
7830
|
+
_pos.moving = false;
|
|
7831
|
+
});
|
|
7832
|
+
_defineProperty(this, "onTouchMove", function(e) {
|
|
7833
|
+
var _pos = _this._pos, config = _this.config;
|
|
7834
|
+
var touch = getTouch(e.touches);
|
|
7835
|
+
var x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7836
|
+
var y = touch ? parseInt(touch.pageY, 10) : e.pageX;
|
|
7837
|
+
var diffx = x - _pos.x;
|
|
7838
|
+
var diffy = y - _pos.y;
|
|
7839
|
+
if (Math.abs(diffy) < config.miniStep && Math.abs(diffx) < config.miniStep) {
|
|
7840
|
+
return;
|
|
7841
|
+
}
|
|
7842
|
+
_this.__clearPress();
|
|
7843
|
+
_pos.press && _this.trigger(EVENTS.PRESS_END, e);
|
|
7844
|
+
_pos.press = false;
|
|
7845
|
+
_pos.moving = true;
|
|
7846
|
+
_this.trigger(EVENTS.TOUCH_MOVE, e);
|
|
7847
|
+
});
|
|
7663
7848
|
this._pos = {
|
|
7664
7849
|
moving: false,
|
|
7665
7850
|
start: false,
|
|
@@ -7667,11 +7852,11 @@ var __publicField = (obj, key, value) => {
|
|
|
7667
7852
|
y: 0
|
|
7668
7853
|
};
|
|
7669
7854
|
this.config = getDefaultConfig();
|
|
7670
|
-
Object.keys(
|
|
7671
|
-
_this.config[key] =
|
|
7855
|
+
Object.keys(_config).map(function(key) {
|
|
7856
|
+
_this.config[key] = _config[key];
|
|
7672
7857
|
});
|
|
7673
7858
|
this.root = dom;
|
|
7674
|
-
this.events =
|
|
7859
|
+
this.events = _config.eventType === "mouse" ? MOUSES : TOUCHS;
|
|
7675
7860
|
this.pressIntrvalId = null;
|
|
7676
7861
|
this.dbIntrvalId = null;
|
|
7677
7862
|
this.__handlers = {};
|
|
@@ -7680,10 +7865,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7680
7865
|
_createClass(Touche2, [{
|
|
7681
7866
|
key: "_initEvent",
|
|
7682
7867
|
value: function _initEvent() {
|
|
7683
|
-
this.onTouchStart = this.onTouchStart.bind(this);
|
|
7684
|
-
this.onTouchMove = this.onTouchMove.bind(this);
|
|
7685
|
-
this.onTouchEnd = this.onTouchEnd.bind(this);
|
|
7686
|
-
this.onTouchCancel = this.onTouchCancel.bind(this);
|
|
7687
7868
|
this.root.addEventListener(this.events.start, this.onTouchStart);
|
|
7688
7869
|
}
|
|
7689
7870
|
}, {
|
|
@@ -7769,60 +7950,6 @@ var __publicField = (obj, key, value) => {
|
|
|
7769
7950
|
}
|
|
7770
7951
|
});
|
|
7771
7952
|
}
|
|
7772
|
-
}, {
|
|
7773
|
-
key: "onTouchStart",
|
|
7774
|
-
value: function onTouchStart(e) {
|
|
7775
|
-
var _pos = this._pos, root = this.root;
|
|
7776
|
-
var touch = getTouch(e.touches);
|
|
7777
|
-
_pos.x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7778
|
-
_pos.y = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7779
|
-
_pos.start = true;
|
|
7780
|
-
this.__setPress(e);
|
|
7781
|
-
root.addEventListener(this.events.end, this.onTouchEnd);
|
|
7782
|
-
root.addEventListener(this.events.cancel, this.onTouchCancel);
|
|
7783
|
-
root.addEventListener(this.events.move, this.onTouchMove);
|
|
7784
|
-
this.trigger(EVENTS.TOUCH_START, e);
|
|
7785
|
-
}
|
|
7786
|
-
}, {
|
|
7787
|
-
key: "onTouchCancel",
|
|
7788
|
-
value: function onTouchCancel(e) {
|
|
7789
|
-
this.onTouchEnd(e);
|
|
7790
|
-
}
|
|
7791
|
-
}, {
|
|
7792
|
-
key: "onTouchEnd",
|
|
7793
|
-
value: function onTouchEnd(e) {
|
|
7794
|
-
var _pos = this._pos, root = this.root;
|
|
7795
|
-
this.__clearPress();
|
|
7796
|
-
root.removeEventListener(this.events.cancel, this.onTouchCancel);
|
|
7797
|
-
root.removeEventListener(this.events.end, this.onTouchEnd);
|
|
7798
|
-
root.removeEventListener(this.events.move, this.onTouchMove);
|
|
7799
|
-
e.moving = _pos.moving;
|
|
7800
|
-
e.press = _pos.press;
|
|
7801
|
-
_pos.press && this.trigger(EVENTS.PRESS_END, e);
|
|
7802
|
-
this.trigger(EVENTS.TOUCH_END, e);
|
|
7803
|
-
!_pos.press && !_pos.moving && this.__setDb(e);
|
|
7804
|
-
_pos.press = false;
|
|
7805
|
-
_pos.start = false;
|
|
7806
|
-
_pos.moving = false;
|
|
7807
|
-
}
|
|
7808
|
-
}, {
|
|
7809
|
-
key: "onTouchMove",
|
|
7810
|
-
value: function onTouchMove(e) {
|
|
7811
|
-
var _pos = this._pos, config = this.config;
|
|
7812
|
-
var touch = getTouch(e.touches);
|
|
7813
|
-
var x = touch ? parseInt(touch.pageX, 10) : e.pageX;
|
|
7814
|
-
var y = touch ? parseInt(touch.pageY, 10) : e.pageX;
|
|
7815
|
-
var diffx = x - _pos.x;
|
|
7816
|
-
var diffy = y - _pos.y;
|
|
7817
|
-
if (Math.abs(diffy) < config.miniStep && Math.abs(diffx) < config.miniStep) {
|
|
7818
|
-
return;
|
|
7819
|
-
}
|
|
7820
|
-
this.__clearPress();
|
|
7821
|
-
_pos.press && this.trigger(EVENTS.PRESS_END, e);
|
|
7822
|
-
_pos.press = false;
|
|
7823
|
-
_pos.moving = true;
|
|
7824
|
-
this.trigger(EVENTS.TOUCH_MOVE, e);
|
|
7825
|
-
}
|
|
7826
7953
|
}, {
|
|
7827
7954
|
key: "destroy",
|
|
7828
7955
|
value: function destroy() {
|
|
@@ -7832,8 +7959,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7832
7959
|
touchmove: "onTouchMove",
|
|
7833
7960
|
touchstart: "onTouchStart"
|
|
7834
7961
|
};
|
|
7835
|
-
Object.keys(map).
|
|
7836
|
-
_this4.root.removeEventListener(
|
|
7962
|
+
Object.keys(map).forEach(function(key) {
|
|
7963
|
+
_this4.root.removeEventListener(key, _this4[map[key]]);
|
|
7837
7964
|
});
|
|
7838
7965
|
}
|
|
7839
7966
|
}]);
|
|
@@ -8484,38 +8611,61 @@ var __publicField = (obj, key, value) => {
|
|
|
8484
8611
|
}
|
|
8485
8612
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
8486
8613
|
_defineProperty(_assertThisInitialized(_this), "onBodyKeyDown", function(event) {
|
|
8487
|
-
|
|
8488
|
-
if (!_this.player || !_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
8614
|
+
if (!_this.player) {
|
|
8489
8615
|
return;
|
|
8490
8616
|
}
|
|
8491
|
-
|
|
8617
|
+
var e = event || window.event;
|
|
8618
|
+
var keyCode = e.keyCode;
|
|
8619
|
+
var _assertThisInitialize = _assertThisInitialized(_this), _keyState = _assertThisInitialize._keyState, player = _assertThisInitialize.player;
|
|
8620
|
+
var _this$config = _this.config, disable = _this$config.disable, disableBodyTrigger = _this$config.disableBodyTrigger, isIgnoreUserActive = _this$config.isIgnoreUserActive;
|
|
8621
|
+
if (disable || disableBodyTrigger || !player.isUserActive && !isIgnoreUserActive || isDisableTag(e.target) || !_this.checkIsVisible() || e.metaKey || e.altKey || e.ctrlKey) {
|
|
8622
|
+
_keyState.isBodyKeyDown = false;
|
|
8492
8623
|
return;
|
|
8493
8624
|
}
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8498
|
-
|
|
8625
|
+
if (!event.repeat && !_keyState.isKeyDown) {
|
|
8626
|
+
if ((e.target === document.body || _this.config.isGlobalTrigger && !isDisableTag(e.target)) && _this.checkCode(keyCode, true)) {
|
|
8627
|
+
_keyState.isBodyKeyDown = true;
|
|
8628
|
+
}
|
|
8629
|
+
document.addEventListener("keyup", _this.onBodyKeyUp);
|
|
8499
8630
|
}
|
|
8500
|
-
|
|
8631
|
+
_keyState.isBodyKeyDown && _this.handleKeyDown(e);
|
|
8501
8632
|
});
|
|
8502
|
-
_defineProperty(_assertThisInitialized(_this), "
|
|
8503
|
-
|
|
8504
|
-
if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
|
|
8633
|
+
_defineProperty(_assertThisInitialized(_this), "onBodyKeyUp", function(event) {
|
|
8634
|
+
if (!_this.player) {
|
|
8505
8635
|
return;
|
|
8506
8636
|
}
|
|
8507
|
-
|
|
8637
|
+
document.removeEventListener("keyup", _this.onBodyKeyUp);
|
|
8638
|
+
_this.handleKeyUp(event);
|
|
8639
|
+
});
|
|
8640
|
+
_defineProperty(_assertThisInitialized(_this), "onKeydown", function(event) {
|
|
8641
|
+
if (!_this.player) {
|
|
8508
8642
|
return;
|
|
8509
8643
|
}
|
|
8510
|
-
|
|
8644
|
+
var e = event || window.event;
|
|
8645
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), _keyState = _assertThisInitialize2._keyState;
|
|
8646
|
+
if (!e.repeat) {
|
|
8647
|
+
if (_this.config.disable || _this.config.disableRootTrigger || e.metaKey || e.altKey || e.ctrlKey) {
|
|
8648
|
+
return;
|
|
8649
|
+
}
|
|
8650
|
+
if (!_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
8651
|
+
return;
|
|
8652
|
+
}
|
|
8653
|
+
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)) {
|
|
8654
|
+
_keyState.isKeyDown = true;
|
|
8655
|
+
}
|
|
8656
|
+
_this.player.root.addEventListener("keyup", _this.onKeyup);
|
|
8657
|
+
}
|
|
8658
|
+
if (!_keyState.isKeyDown) {
|
|
8511
8659
|
return;
|
|
8512
8660
|
}
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8516
|
-
|
|
8661
|
+
_this.handleKeyDown(e);
|
|
8662
|
+
});
|
|
8663
|
+
_defineProperty(_assertThisInitialized(_this), "onKeyup", function(event) {
|
|
8664
|
+
if (!_this.player) {
|
|
8665
|
+
return;
|
|
8517
8666
|
}
|
|
8518
|
-
_this.
|
|
8667
|
+
_this.player.root.removeEventListener("keyup", _this.onKeyup);
|
|
8668
|
+
_this.handleKeyUp(event);
|
|
8519
8669
|
});
|
|
8520
8670
|
return _this;
|
|
8521
8671
|
}
|
|
@@ -8529,7 +8679,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8529
8679
|
if (!_this2.keyCodeMap[key]) {
|
|
8530
8680
|
_this2.keyCodeMap[key] = extendkeyCodeMap[key];
|
|
8531
8681
|
} else {
|
|
8532
|
-
["keyCode", "action", "disable", "isBodyTarget"].map(function(key1) {
|
|
8682
|
+
["keyCode", "action", "disable", "pressAction", "disablePress", "isBodyTarget"].map(function(key1) {
|
|
8533
8683
|
extendkeyCodeMap[key][key1] && (_this2.keyCodeMap[key][key1] = extendkeyCodeMap[key][key1]);
|
|
8534
8684
|
});
|
|
8535
8685
|
}
|
|
@@ -8549,37 +8699,51 @@ var __publicField = (obj, key, value) => {
|
|
|
8549
8699
|
keyCode: 32,
|
|
8550
8700
|
action: "playPause",
|
|
8551
8701
|
disable: false,
|
|
8702
|
+
disablePress: false,
|
|
8552
8703
|
noBodyTarget: false
|
|
8553
8704
|
},
|
|
8554
8705
|
up: {
|
|
8555
8706
|
keyCode: 38,
|
|
8556
8707
|
action: "upVolume",
|
|
8557
8708
|
disable: false,
|
|
8709
|
+
disablePress: false,
|
|
8558
8710
|
noBodyTarget: true
|
|
8559
8711
|
},
|
|
8560
8712
|
down: {
|
|
8561
8713
|
keyCode: 40,
|
|
8562
8714
|
action: "downVolume",
|
|
8563
8715
|
disable: false,
|
|
8716
|
+
disablePress: false,
|
|
8564
8717
|
noBodyTarget: true
|
|
8565
8718
|
},
|
|
8566
8719
|
left: {
|
|
8567
8720
|
keyCode: 37,
|
|
8568
8721
|
action: "seekBack",
|
|
8722
|
+
disablePress: false,
|
|
8569
8723
|
disable: false
|
|
8570
8724
|
},
|
|
8571
8725
|
right: {
|
|
8572
8726
|
keyCode: 39,
|
|
8573
8727
|
action: "seek",
|
|
8728
|
+
pressAction: "changePlaybackRate",
|
|
8729
|
+
disablePress: false,
|
|
8574
8730
|
disable: false
|
|
8575
8731
|
},
|
|
8576
8732
|
esc: {
|
|
8577
8733
|
keyCode: 27,
|
|
8578
8734
|
action: "exitFullscreen",
|
|
8735
|
+
disablePress: true,
|
|
8579
8736
|
disable: false
|
|
8580
8737
|
}
|
|
8581
8738
|
};
|
|
8582
8739
|
this.mergekeyCodeMap();
|
|
8740
|
+
this._keyState = {
|
|
8741
|
+
isKeyDown: false,
|
|
8742
|
+
isBodyKeyDown: false,
|
|
8743
|
+
isPress: false,
|
|
8744
|
+
tt: 0,
|
|
8745
|
+
playbackRate: 0
|
|
8746
|
+
};
|
|
8583
8747
|
this.player.root.addEventListener("keydown", this.onKeydown);
|
|
8584
8748
|
document.addEventListener("keydown", this.onBodyKeyDown);
|
|
8585
8749
|
}
|
|
@@ -8613,6 +8777,9 @@ var __publicField = (obj, key, value) => {
|
|
|
8613
8777
|
key: "downVolume",
|
|
8614
8778
|
value: function downVolume(event) {
|
|
8615
8779
|
var player = this.player;
|
|
8780
|
+
if (player.volume <= 0) {
|
|
8781
|
+
return;
|
|
8782
|
+
}
|
|
8616
8783
|
var val = parseFloat((player.volume - 0.1).toFixed(1));
|
|
8617
8784
|
var props = {
|
|
8618
8785
|
volume: {
|
|
@@ -8633,6 +8800,9 @@ var __publicField = (obj, key, value) => {
|
|
|
8633
8800
|
key: "upVolume",
|
|
8634
8801
|
value: function upVolume(event) {
|
|
8635
8802
|
var player = this.player;
|
|
8803
|
+
if (player.volume >= 1) {
|
|
8804
|
+
return;
|
|
8805
|
+
}
|
|
8636
8806
|
var val = parseFloat((player.volume + 0.1).toFixed(1));
|
|
8637
8807
|
var props = {
|
|
8638
8808
|
volume: {
|
|
@@ -8652,42 +8822,57 @@ var __publicField = (obj, key, value) => {
|
|
|
8652
8822
|
}, {
|
|
8653
8823
|
key: "seek",
|
|
8654
8824
|
value: function seek(event) {
|
|
8655
|
-
var _this$player = this.player, currentTime = _this$player.currentTime, duration = _this$player.duration;
|
|
8656
|
-
var _time = currentTime;
|
|
8657
|
-
|
|
8658
|
-
|
|
8825
|
+
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;
|
|
8826
|
+
var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
|
|
8827
|
+
var _duration = offsetDuration || duration;
|
|
8828
|
+
var _step = event.repeat && this.seekStep >= 4 ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
8829
|
+
if (_time + _step <= _duration) {
|
|
8830
|
+
_time = _time + _step;
|
|
8659
8831
|
} else {
|
|
8660
|
-
_time =
|
|
8832
|
+
_time = _duration;
|
|
8661
8833
|
}
|
|
8834
|
+
var _seekTime = util.getCurrentTimeByOffset(_time, timeSegments);
|
|
8662
8835
|
var props = {
|
|
8663
8836
|
currentTime: {
|
|
8664
8837
|
from: currentTime,
|
|
8665
|
-
to:
|
|
8838
|
+
to: _seekTime
|
|
8666
8839
|
}
|
|
8667
8840
|
};
|
|
8668
8841
|
this.emitUserAction(event, "seek", {
|
|
8669
8842
|
props
|
|
8670
8843
|
});
|
|
8671
|
-
this.player.currentTime =
|
|
8844
|
+
this.player.currentTime = _seekTime;
|
|
8672
8845
|
}
|
|
8673
8846
|
}, {
|
|
8674
8847
|
key: "seekBack",
|
|
8675
8848
|
value: function seekBack(event) {
|
|
8676
|
-
var
|
|
8677
|
-
var
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8849
|
+
var _this$player2 = this.player, currentTime = _this$player2.currentTime, offsetCurrentTime = _this$player2.offsetCurrentTime, timeSegments = _this$player2.timeSegments;
|
|
8850
|
+
var _step = event.repeat ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
8851
|
+
var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
|
|
8852
|
+
var _seekTime = _time - _step;
|
|
8853
|
+
if (_seekTime < 0) {
|
|
8854
|
+
_seekTime = 0;
|
|
8855
|
+
}
|
|
8856
|
+
_seekTime = util.getCurrentTimeByOffset(_seekTime, timeSegments);
|
|
8681
8857
|
var props = {
|
|
8682
8858
|
currentTime: {
|
|
8683
8859
|
from: currentTime,
|
|
8684
|
-
to:
|
|
8860
|
+
to: _seekTime
|
|
8685
8861
|
}
|
|
8686
8862
|
};
|
|
8687
8863
|
this.emitUserAction(event, "seek", {
|
|
8688
8864
|
props
|
|
8689
8865
|
});
|
|
8690
|
-
this.player.currentTime =
|
|
8866
|
+
this.player.currentTime = _seekTime;
|
|
8867
|
+
}
|
|
8868
|
+
}, {
|
|
8869
|
+
key: "changePlaybackRate",
|
|
8870
|
+
value: function changePlaybackRate(event) {
|
|
8871
|
+
var _keyState = this._keyState, config = this.config, player = this.player;
|
|
8872
|
+
if (_keyState.playbackRate === 0) {
|
|
8873
|
+
_keyState.playbackRate = player.playbackRate;
|
|
8874
|
+
player.playbackRate = config.playbackRate;
|
|
8875
|
+
}
|
|
8691
8876
|
}
|
|
8692
8877
|
}, {
|
|
8693
8878
|
key: "playPause",
|
|
@@ -8725,32 +8910,66 @@ var __publicField = (obj, key, value) => {
|
|
|
8725
8910
|
player.exitCssFullscreen();
|
|
8726
8911
|
}
|
|
8727
8912
|
}
|
|
8913
|
+
}, {
|
|
8914
|
+
key: "handleKeyDown",
|
|
8915
|
+
value: function handleKeyDown(e) {
|
|
8916
|
+
var _keyState = this._keyState;
|
|
8917
|
+
if (e.repeat) {
|
|
8918
|
+
_keyState.isPress = true;
|
|
8919
|
+
var _t = Date.now();
|
|
8920
|
+
if (_t - _keyState.tt < 200) {
|
|
8921
|
+
return;
|
|
8922
|
+
}
|
|
8923
|
+
_keyState.tt = _t;
|
|
8924
|
+
}
|
|
8925
|
+
preventDefault(e);
|
|
8926
|
+
this.handleKeyCode(e.keyCode, e, _keyState.isPress);
|
|
8927
|
+
}
|
|
8928
|
+
}, {
|
|
8929
|
+
key: "handleKeyUp",
|
|
8930
|
+
value: function handleKeyUp(e) {
|
|
8931
|
+
var _keyState = this._keyState;
|
|
8932
|
+
if (_keyState.playbackRate > 0) {
|
|
8933
|
+
this.player.playbackRate = _keyState.playbackRate;
|
|
8934
|
+
_keyState.playbackRate = 0;
|
|
8935
|
+
}
|
|
8936
|
+
_keyState.isKeyDown = false;
|
|
8937
|
+
_keyState.isPress = false;
|
|
8938
|
+
_keyState.tt = 0;
|
|
8939
|
+
}
|
|
8728
8940
|
}, {
|
|
8729
8941
|
key: "handleKeyCode",
|
|
8730
|
-
value: function handleKeyCode(curKeyCode, event) {
|
|
8731
|
-
var
|
|
8732
|
-
|
|
8733
|
-
var
|
|
8734
|
-
if (keyCode === curKeyCode
|
|
8735
|
-
if (
|
|
8736
|
-
action
|
|
8737
|
-
|
|
8738
|
-
|
|
8739
|
-
|
|
8942
|
+
value: function handleKeyCode(curKeyCode, event, isPress) {
|
|
8943
|
+
var arr = Object.keys(this.keyCodeMap);
|
|
8944
|
+
for (var i = 0; i < arr.length; i++) {
|
|
8945
|
+
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;
|
|
8946
|
+
if (keyCode === curKeyCode) {
|
|
8947
|
+
if (!disable && !(isPress && disablePress)) {
|
|
8948
|
+
var _action = !isPress ? action : pressAction || action;
|
|
8949
|
+
if (typeof _action === "function") {
|
|
8950
|
+
action(event, this.player, isPress);
|
|
8951
|
+
} else if (typeof _action === "string") {
|
|
8952
|
+
if (typeof this[_action] === "function") {
|
|
8953
|
+
this[_action](event, this.player, isPress);
|
|
8954
|
+
}
|
|
8740
8955
|
}
|
|
8956
|
+
this.emit(SHORTCUT, _objectSpread2({
|
|
8957
|
+
key: arr[i],
|
|
8958
|
+
target: event.target,
|
|
8959
|
+
isPress
|
|
8960
|
+
}, this.keyCodeMap[arr[i]]));
|
|
8741
8961
|
}
|
|
8742
|
-
|
|
8743
|
-
key,
|
|
8744
|
-
target: event.target
|
|
8745
|
-
}, _this4.keyCodeMap[key]));
|
|
8962
|
+
break;
|
|
8746
8963
|
}
|
|
8747
|
-
}
|
|
8964
|
+
}
|
|
8748
8965
|
}
|
|
8749
8966
|
}, {
|
|
8750
8967
|
key: "destroy",
|
|
8751
8968
|
value: function destroy() {
|
|
8752
8969
|
this.player.root.removeEventListener("keydown", this.onKeydown);
|
|
8753
8970
|
document.removeEventListener("keydown", this.onBodyKeyDown);
|
|
8971
|
+
this.player.root.removeEventListener("keyup", this.onKeyup);
|
|
8972
|
+
document.removeEventListener("keyup", this.onBodyKeyUp);
|
|
8754
8973
|
}
|
|
8755
8974
|
}, {
|
|
8756
8975
|
key: "disable",
|
|
@@ -8772,12 +8991,13 @@ var __publicField = (obj, key, value) => {
|
|
|
8772
8991
|
get: function get() {
|
|
8773
8992
|
return {
|
|
8774
8993
|
seekStep: 10,
|
|
8775
|
-
checkVisible:
|
|
8994
|
+
checkVisible: false,
|
|
8776
8995
|
disableBodyTrigger: false,
|
|
8777
8996
|
disableRootTrigger: false,
|
|
8778
8997
|
isGlobalTrigger: false,
|
|
8779
8998
|
keyCodeMap: {},
|
|
8780
8999
|
disable: false,
|
|
9000
|
+
playbackRate: 2,
|
|
8781
9001
|
isIgnoreUserActive: false
|
|
8782
9002
|
};
|
|
8783
9003
|
}
|
|
@@ -10070,6 +10290,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10070
10290
|
get url() {
|
|
10071
10291
|
return this._currentUrlRef.url;
|
|
10072
10292
|
}
|
|
10293
|
+
set url(url) {
|
|
10294
|
+
this._currentUrlRef.url = url;
|
|
10295
|
+
}
|
|
10073
10296
|
next() {
|
|
10074
10297
|
const next = this._currentUrlRef.next;
|
|
10075
10298
|
/* istanbul ignore next -- @preserve */
|
|
@@ -10147,7 +10370,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10147
10370
|
__publicField(this, "defaultSource");
|
|
10148
10371
|
__publicField(this, "defaultDefinition");
|
|
10149
10372
|
__publicField(this, "maxFallbackRound");
|
|
10150
|
-
__publicField(this, "_prepareList", []);
|
|
10151
10373
|
__publicField(this, "_currentDefinition");
|
|
10152
10374
|
__publicField(this, "_sources");
|
|
10153
10375
|
__publicField(this, "_fallbackCount", 0);
|
|
@@ -10182,6 +10404,11 @@ var __publicField = (obj, key, value) => {
|
|
|
10182
10404
|
var _a;
|
|
10183
10405
|
return (_a = this.definition) == null ? void 0 : _a.url;
|
|
10184
10406
|
}
|
|
10407
|
+
set url(url) {
|
|
10408
|
+
if (this.definition) {
|
|
10409
|
+
this.definition.url = url;
|
|
10410
|
+
}
|
|
10411
|
+
}
|
|
10185
10412
|
/**
|
|
10186
10413
|
* 以给定的参数搜索源和对应清晰度。`source` 和 `definition`
|
|
10187
10414
|
* 都是可选的,当未指定时,使用当前的 {@link SourceManager.source}
|
|
@@ -10251,14 +10478,6 @@ var __publicField = (obj, key, value) => {
|
|
|
10251
10478
|
this.resetFallback();
|
|
10252
10479
|
return this;
|
|
10253
10480
|
}
|
|
10254
|
-
registerPrepare(prepare) {
|
|
10255
|
-
this._prepareList.push(prepare);
|
|
10256
|
-
}
|
|
10257
|
-
async prepare(url) {
|
|
10258
|
-
for (const prepare of this._prepareList) {
|
|
10259
|
-
await prepare(url);
|
|
10260
|
-
}
|
|
10261
|
-
}
|
|
10262
10481
|
resetFallback() {
|
|
10263
10482
|
this._fallbackCount = 0;
|
|
10264
10483
|
}
|
|
@@ -11849,9 +12068,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11849
12068
|
toastPlugin.remove(this._toastId);
|
|
11850
12069
|
}
|
|
11851
12070
|
this._toastId = toastPlugin.toast(
|
|
11852
|
-
`${i18nManager.getText("DEFINITION_SWITCHING")} ${
|
|
11853
|
-
definition.text
|
|
11854
|
-
)) ?? definition.definition} ...`,
|
|
12071
|
+
`${i18nManager.getText("DEFINITION_SWITCHING")} ${definition.showText ?? definition.definition} ...`,
|
|
11855
12072
|
{
|
|
11856
12073
|
duration: 2e3,
|
|
11857
12074
|
closable: true
|
|
@@ -12745,7 +12962,6 @@ var __publicField = (obj, key, value) => {
|
|
|
12745
12962
|
veplayer: this
|
|
12746
12963
|
});
|
|
12747
12964
|
this.emit(Events.PLAYER_CREATE_FINISH, this._player);
|
|
12748
|
-
this._sourceManager.registerPrepare((url) => this.prepare(url));
|
|
12749
12965
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
12750
12966
|
this._player.on(ERROR, this._errorCallback);
|
|
12751
12967
|
}
|
|
@@ -12911,7 +13127,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12911
13127
|
return;
|
|
12912
13128
|
}
|
|
12913
13129
|
if (!VeI18n.isLangValid(lang)) {
|
|
12914
|
-
const langKeys = VeI18n.langKeys
|
|
13130
|
+
const langKeys = VeI18n.langKeys.join(",");
|
|
12915
13131
|
const message = {
|
|
12916
13132
|
en: `Sorry, we couldn't set the language to ${lang} because it's not currently supported. The list of supported languages includes ${langKeys}.`,
|
|
12917
13133
|
"zh-cn": `不支持当前设置的语言${lang}, 支持的语言有${langKeys}, 请重新设置`
|
|
@@ -12930,7 +13146,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12930
13146
|
* @hidden
|
|
12931
13147
|
*/
|
|
12932
13148
|
static async create(options = {}, Constructor) {
|
|
12933
|
-
var _a;
|
|
13149
|
+
var _a, _b, _c;
|
|
12934
13150
|
const sourceManager = new SourceManager({
|
|
12935
13151
|
sources: Source.normalize({
|
|
12936
13152
|
url: options.url,
|
|
@@ -12942,8 +13158,14 @@ var __publicField = (obj, key, value) => {
|
|
|
12942
13158
|
defaultDefinition: options.defaultDefinition,
|
|
12943
13159
|
maxFallbackRound: options.maxFallbackRound
|
|
12944
13160
|
});
|
|
13161
|
+
const prepareResult = await ((_a = options == null ? void 0 : options.preparePlugins) == null ? void 0 : _a.call(
|
|
13162
|
+
options,
|
|
13163
|
+
sourceManager.url ?? ""
|
|
13164
|
+
));
|
|
13165
|
+
if ((_b = prepareResult == null ? void 0 : prepareResult.options) == null ? void 0 : _b.url) {
|
|
13166
|
+
sourceManager.url = (_c = prepareResult == null ? void 0 : prepareResult.options) == null ? void 0 : _c.url;
|
|
13167
|
+
}
|
|
12945
13168
|
options.url = sourceManager.url;
|
|
12946
|
-
const prepareResult = await ((_a = options == null ? void 0 : options.preparePlugins) == null ? void 0 : _a.call(options, options.url ?? ""));
|
|
12947
13169
|
return new (Constructor ?? VePlayerBase)({
|
|
12948
13170
|
...options,
|
|
12949
13171
|
prepareResult,
|
|
@@ -12958,7 +13180,6 @@ var __publicField = (obj, key, value) => {
|
|
|
12958
13180
|
async switch(target, options) {
|
|
12959
13181
|
var _a, _b;
|
|
12960
13182
|
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) {
|
|
12961
|
-
this._sourceManager.updateSources(target);
|
|
12962
13183
|
await this._switchUrl(target);
|
|
12963
13184
|
return this._sourceManager.definition;
|
|
12964
13185
|
}
|
|
@@ -13097,7 +13318,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13097
13318
|
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13098
13319
|
* @param el 全屏作用的 DOM 节点。
|
|
13099
13320
|
*/
|
|
13100
|
-
|
|
13321
|
+
requestFullscreen(el) {
|
|
13101
13322
|
return this._player.getFullscreen(el);
|
|
13102
13323
|
}
|
|
13103
13324
|
/**
|
|
@@ -13111,7 +13332,7 @@ var __publicField = (obj, key, value) => {
|
|
|
13111
13332
|
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13112
13333
|
* @param el 全屏作用的 DOM 节点。
|
|
13113
13334
|
*/
|
|
13114
|
-
|
|
13335
|
+
requestCssFullscreen(el) {
|
|
13115
13336
|
return this._player.getCssFullscreen(el);
|
|
13116
13337
|
}
|
|
13117
13338
|
/**
|
|
@@ -13194,9 +13415,12 @@ var __publicField = (obj, key, value) => {
|
|
|
13194
13415
|
if (result == null ? void 0 : result.options) {
|
|
13195
13416
|
this._player.setConfig(result.options);
|
|
13196
13417
|
}
|
|
13197
|
-
return
|
|
13198
|
-
|
|
13199
|
-
|
|
13418
|
+
return {
|
|
13419
|
+
plugins: addedPlugins.map((plugin) => {
|
|
13420
|
+
return this._player.registerPlugin(plugin);
|
|
13421
|
+
}),
|
|
13422
|
+
options: result == null ? void 0 : result.options
|
|
13423
|
+
};
|
|
13200
13424
|
}
|
|
13201
13425
|
async _handleFallback(err) {
|
|
13202
13426
|
this._player.addClass(STATE_CLASS.ENTER);
|
|
@@ -13231,7 +13455,10 @@ var __publicField = (obj, key, value) => {
|
|
|
13231
13455
|
async _switch(targetDefinition) {
|
|
13232
13456
|
var _a, _b, _c, _d, _e, _f;
|
|
13233
13457
|
const preDefinition = clonedeep(this._sourceManager.definition);
|
|
13234
|
-
const newPlugins = await this.prepare(targetDefinition.url);
|
|
13458
|
+
const { plugins: newPlugins, options } = await this.prepare(targetDefinition.url) || {};
|
|
13459
|
+
if (options == null ? void 0 : options.url) {
|
|
13460
|
+
targetDefinition.url = options == null ? void 0 : options.url;
|
|
13461
|
+
}
|
|
13235
13462
|
this._sourceManager.switch(targetDefinition);
|
|
13236
13463
|
(_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
|
|
13237
13464
|
(_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
|
|
@@ -13247,11 +13474,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13247
13474
|
}
|
|
13248
13475
|
}
|
|
13249
13476
|
async _switchUrl(url) {
|
|
13250
|
-
const newPlugins = await this.prepare(url);
|
|
13477
|
+
const { plugins: newPlugins, options } = await this.prepare(url) || {};
|
|
13478
|
+
const newUrl = (options == null ? void 0 : options.url) ?? url;
|
|
13479
|
+
this._sourceManager.updateSources(newUrl);
|
|
13251
13480
|
if (newPlugins == null ? void 0 : newPlugins.length) {
|
|
13252
|
-
this._callBeforePlayerInitForUrl(newPlugins,
|
|
13481
|
+
this._callBeforePlayerInitForUrl(newPlugins, newUrl);
|
|
13253
13482
|
} else {
|
|
13254
|
-
const res = this._player.switchURL(
|
|
13483
|
+
const res = this._player.switchURL(newUrl, false);
|
|
13255
13484
|
const curTime = this._player.currentTime;
|
|
13256
13485
|
if (res && res.then) {
|
|
13257
13486
|
return res;
|