@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,21 @@ 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 Degradation = /* @__PURE__ */ ((Degradation2) => {
|
|
13
|
+
Degradation2["SoftFirst"] = "soft-first";
|
|
14
|
+
Degradation2["H264First"] = "h264-first";
|
|
15
|
+
return Degradation2;
|
|
16
|
+
})(Degradation || {});
|
|
17
|
+
var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
|
|
18
|
+
DecodeType2["Software"] = "software";
|
|
19
|
+
DecodeType2["Hardware"] = "hardware";
|
|
20
|
+
return DecodeType2;
|
|
21
|
+
})(DecodeType || {});
|
|
7
22
|
function ownKeys$1(object, enumerableOnly) {
|
|
8
23
|
var keys = Object.keys(object);
|
|
9
24
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -1000,6 +1015,9 @@ util$1.isMSE = function(video) {
|
|
|
1000
1015
|
}
|
|
1001
1016
|
return /^blob/.test(video.currentSrc) || /^blob/.test(video.src);
|
|
1002
1017
|
};
|
|
1018
|
+
util$1.isBlob = function(url) {
|
|
1019
|
+
return /^blob/.test(url);
|
|
1020
|
+
};
|
|
1003
1021
|
util$1.generateSessionId = function() {
|
|
1004
1022
|
var did = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
|
|
1005
1023
|
var d2 = (/* @__PURE__ */ new Date()).getTime();
|
|
@@ -1060,6 +1078,69 @@ util$1.convertDeg = function(val) {
|
|
|
1060
1078
|
}
|
|
1061
1079
|
return val % 360;
|
|
1062
1080
|
};
|
|
1081
|
+
util$1.getIndexByTime = function(time, segments) {
|
|
1082
|
+
var _len = segments.length;
|
|
1083
|
+
var _index = -1;
|
|
1084
|
+
if (_len < 1) {
|
|
1085
|
+
return _index;
|
|
1086
|
+
}
|
|
1087
|
+
if (time <= segments[0].end || _len < 2) {
|
|
1088
|
+
_index = 0;
|
|
1089
|
+
} else if (time > segments[_len - 1].end) {
|
|
1090
|
+
_index = _len - 1;
|
|
1091
|
+
} else {
|
|
1092
|
+
for (var i2 = 1; i2 < _len; i2++) {
|
|
1093
|
+
if (time > segments[i2 - 1].end && time <= segments[i2].end) {
|
|
1094
|
+
_index = i2;
|
|
1095
|
+
break;
|
|
1096
|
+
}
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
return _index;
|
|
1100
|
+
};
|
|
1101
|
+
util$1.getOffsetCurrentTime = function(currentTime, segments) {
|
|
1102
|
+
var index = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : -1;
|
|
1103
|
+
var _index = -1;
|
|
1104
|
+
if (index >= 0 && index < segments.length) {
|
|
1105
|
+
_index = index;
|
|
1106
|
+
} else {
|
|
1107
|
+
_index = util$1.getIndexByTime(currentTime, segments);
|
|
1108
|
+
}
|
|
1109
|
+
if (_index < 0) {
|
|
1110
|
+
return -1;
|
|
1111
|
+
}
|
|
1112
|
+
var _len = segments.length;
|
|
1113
|
+
var _segments$_index = segments[_index], start = _segments$_index.start, end = _segments$_index.end, cTime = _segments$_index.cTime, offset = _segments$_index.offset;
|
|
1114
|
+
if (currentTime < start) {
|
|
1115
|
+
return cTime;
|
|
1116
|
+
} else if (currentTime >= start && currentTime <= end) {
|
|
1117
|
+
return currentTime - offset;
|
|
1118
|
+
} else if (currentTime > end && _index >= _len - 1) {
|
|
1119
|
+
return end;
|
|
1120
|
+
}
|
|
1121
|
+
return -1;
|
|
1122
|
+
};
|
|
1123
|
+
util$1.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
1124
|
+
var _index = -1;
|
|
1125
|
+
if (!segments || segments.length < 0) {
|
|
1126
|
+
return offsetTime;
|
|
1127
|
+
}
|
|
1128
|
+
for (var i2 = 0; i2 < segments.length; i2++) {
|
|
1129
|
+
if (offsetTime <= segments[i2].duration) {
|
|
1130
|
+
_index = i2;
|
|
1131
|
+
break;
|
|
1132
|
+
}
|
|
1133
|
+
}
|
|
1134
|
+
if (_index !== -1) {
|
|
1135
|
+
var start = segments[_index].start;
|
|
1136
|
+
if (_index - 1 < 0) {
|
|
1137
|
+
return start + offsetTime;
|
|
1138
|
+
} else {
|
|
1139
|
+
return start + (offsetTime - segments[_index - 1].duration);
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
return offsetTime;
|
|
1143
|
+
};
|
|
1063
1144
|
function isObject$1(value) {
|
|
1064
1145
|
var type = _typeof(value);
|
|
1065
1146
|
return value !== null && (type === "object" || type === "function");
|
|
@@ -1149,7 +1230,7 @@ function debounce$2(func, wait, options) {
|
|
|
1149
1230
|
function debounced() {
|
|
1150
1231
|
var time = Date.now();
|
|
1151
1232
|
var isInvoking = shouldInvoke(time);
|
|
1152
|
-
for (var
|
|
1233
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key = 0; _key < _len2; _key++) {
|
|
1153
1234
|
args[_key] = arguments[_key];
|
|
1154
1235
|
}
|
|
1155
1236
|
lastArgs = args;
|
|
@@ -1356,7 +1437,7 @@ var sniffer$1 = {
|
|
|
1356
1437
|
}
|
|
1357
1438
|
}
|
|
1358
1439
|
};
|
|
1359
|
-
var version = "3.0.
|
|
1440
|
+
var version = "3.0.10-alpha.4";
|
|
1360
1441
|
var ERROR_TYPE_MAP = {
|
|
1361
1442
|
1: "media",
|
|
1362
1443
|
2: "media",
|
|
@@ -1442,6 +1523,7 @@ var CANPLAY_THROUGH = "canplaythrough";
|
|
|
1442
1523
|
var DURATION_CHANGE = "durationchange";
|
|
1443
1524
|
var VOLUME_CHANGE = "volumechange";
|
|
1444
1525
|
var LOADED_DATA = "loadeddata";
|
|
1526
|
+
var LOADED_METADATA = "loadedmetadata";
|
|
1445
1527
|
var RATE_CHANGE = "ratechange";
|
|
1446
1528
|
var PROGRESS = "progress";
|
|
1447
1529
|
var LOAD_START = "loadstart";
|
|
@@ -1481,7 +1563,7 @@ var RESET = "reset";
|
|
|
1481
1563
|
var SOURCE_ERROR = "source_error";
|
|
1482
1564
|
var SOURCE_SUCCESS = "source_success";
|
|
1483
1565
|
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"];
|
|
1566
|
+
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
1567
|
var STATS_EVENTS = {
|
|
1486
1568
|
STATS_INFO: "stats_info",
|
|
1487
1569
|
STATS_DOWNLOAD: "stats_download",
|
|
@@ -1510,6 +1592,7 @@ var XGEvents = /* @__PURE__ */ Object.freeze({
|
|
|
1510
1592
|
FPS_STUCK,
|
|
1511
1593
|
FULLSCREEN_CHANGE,
|
|
1512
1594
|
LOADED_DATA,
|
|
1595
|
+
LOADED_METADATA,
|
|
1513
1596
|
LOAD_START,
|
|
1514
1597
|
MINI_STATE_CHANGE,
|
|
1515
1598
|
PAUSE,
|
|
@@ -1647,6 +1730,9 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1647
1730
|
if (options.loop) {
|
|
1648
1731
|
_this.mediaConfig.loop = "loop";
|
|
1649
1732
|
}
|
|
1733
|
+
if (options.autoplayMuted && !Object.prototype.hasOwnProperty.call(_this.mediaConfig, "muted")) {
|
|
1734
|
+
_this.mediaConfig.muted = true;
|
|
1735
|
+
}
|
|
1650
1736
|
_this.media = util$1.createDom(_this.mediaConfig.mediaType, "", _this.mediaConfig, "");
|
|
1651
1737
|
if (options.defaultPlaybackRate) {
|
|
1652
1738
|
_this.media.defaultPlaybackRate = _this.media.playbackRate = options.defaultPlaybackRate;
|
|
@@ -1725,10 +1811,11 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1725
1811
|
var _this6 = this;
|
|
1726
1812
|
video.removeAttribute("src");
|
|
1727
1813
|
video.load();
|
|
1728
|
-
urls.forEach(function(item) {
|
|
1814
|
+
urls.forEach(function(item, index) {
|
|
1729
1815
|
_this6.media.appendChild(util$1.createDom("source", "", {
|
|
1730
1816
|
src: "".concat(item.src),
|
|
1731
|
-
type: "".concat(item.type || "")
|
|
1817
|
+
type: "".concat(item.type || ""),
|
|
1818
|
+
"data-index": index + 1
|
|
1732
1819
|
}));
|
|
1733
1820
|
});
|
|
1734
1821
|
var _c = video.children;
|
|
@@ -1736,6 +1823,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1736
1823
|
return;
|
|
1737
1824
|
}
|
|
1738
1825
|
this._videoSourceCount = _c.length;
|
|
1826
|
+
this._videoSourceIndex = _c.length;
|
|
1739
1827
|
this._vLoadeddata = function(e3) {
|
|
1740
1828
|
_this6.emit(SOURCE_SUCCESS, {
|
|
1741
1829
|
src: e3.target.currentSrc,
|
|
@@ -1750,8 +1838,9 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
1750
1838
|
}
|
|
1751
1839
|
}
|
|
1752
1840
|
!this._sourceError && (this._sourceError = function(e3) {
|
|
1753
|
-
|
|
1754
|
-
|
|
1841
|
+
var _dIndex = parseInt(e3.target.getAttribute("data-index"), 10);
|
|
1842
|
+
_this6._videoSourceIndex--;
|
|
1843
|
+
if (_this6._videoSourceIndex === 0 || _dIndex >= _this6._videoSourceCount) {
|
|
1755
1844
|
var _err = {
|
|
1756
1845
|
code: 4,
|
|
1757
1846
|
message: "sources_load_error"
|
|
@@ -2078,7 +2167,7 @@ var MediaProxy = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
2078
2167
|
this.emit(WAITING);
|
|
2079
2168
|
this._currentTime = 0;
|
|
2080
2169
|
this._duration = 0;
|
|
2081
|
-
if (
|
|
2170
|
+
if (util$1.isMSE(this.media)) {
|
|
2082
2171
|
this.onWaiting();
|
|
2083
2172
|
return;
|
|
2084
2173
|
}
|
|
@@ -3786,6 +3875,7 @@ function getDefaultConfig$1() {
|
|
|
3786
3875
|
},
|
|
3787
3876
|
enableSwipeHandler: function enableSwipeHandler() {
|
|
3788
3877
|
},
|
|
3878
|
+
preProcessUrl: null,
|
|
3789
3879
|
ignores: [],
|
|
3790
3880
|
whitelist: [],
|
|
3791
3881
|
inactive: 3e3,
|
|
@@ -3867,7 +3957,7 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
3867
3957
|
autoHide: false
|
|
3868
3958
|
});
|
|
3869
3959
|
});
|
|
3870
|
-
_defineProperty$1(_assertThisInitialized(_this), "onMouseLeave", function() {
|
|
3960
|
+
_defineProperty$1(_assertThisInitialized(_this), "onMouseLeave", function(e3) {
|
|
3871
3961
|
var _assertThisInitialize2 = _assertThisInitialized(_this), player = _assertThisInitialize2.player;
|
|
3872
3962
|
player.focus();
|
|
3873
3963
|
});
|
|
@@ -3945,12 +4035,13 @@ var Controls = /* @__PURE__ */ function(_Plugin) {
|
|
|
3945
4035
|
}, {
|
|
3946
4036
|
key: "show",
|
|
3947
4037
|
value: function show() {
|
|
3948
|
-
|
|
4038
|
+
this.root.style.display = "";
|
|
4039
|
+
this.player.focus();
|
|
3949
4040
|
}
|
|
3950
4041
|
}, {
|
|
3951
4042
|
key: "hide",
|
|
3952
4043
|
value: function hide() {
|
|
3953
|
-
|
|
4044
|
+
this.root.style.display = "none";
|
|
3954
4045
|
}
|
|
3955
4046
|
}, {
|
|
3956
4047
|
key: "mode",
|
|
@@ -4352,6 +4443,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4352
4443
|
_this.cssfullscreen = false;
|
|
4353
4444
|
_this.isRotateFullscreen = false;
|
|
4354
4445
|
_this._fullscreenEl = null;
|
|
4446
|
+
_this.timeSegments = [];
|
|
4355
4447
|
_this._cssfullscreenEl = null;
|
|
4356
4448
|
_this.curDefinition = null;
|
|
4357
4449
|
_this._orgCss = "";
|
|
@@ -4361,7 +4453,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4361
4453
|
_this.videoPos = {
|
|
4362
4454
|
pi: 1,
|
|
4363
4455
|
scale: 0,
|
|
4364
|
-
rotate:
|
|
4456
|
+
rotate: -1,
|
|
4365
4457
|
x: 0,
|
|
4366
4458
|
y: 0,
|
|
4367
4459
|
h: -1,
|
|
@@ -4369,11 +4461,21 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4369
4461
|
vy: 0,
|
|
4370
4462
|
vx: 0
|
|
4371
4463
|
};
|
|
4464
|
+
_this.sizeInfo = {
|
|
4465
|
+
width: 0,
|
|
4466
|
+
height: 0,
|
|
4467
|
+
left: 0,
|
|
4468
|
+
top: 0
|
|
4469
|
+
};
|
|
4372
4470
|
_this._accPlayed = {
|
|
4373
4471
|
t: 0,
|
|
4374
4472
|
acc: 0,
|
|
4375
4473
|
loopAcc: 0
|
|
4376
4474
|
};
|
|
4475
|
+
_this._offsetInfo = {
|
|
4476
|
+
currentTime: -1,
|
|
4477
|
+
duration: 0
|
|
4478
|
+
};
|
|
4377
4479
|
_this.innerContainer = null;
|
|
4378
4480
|
_this.controls = null;
|
|
4379
4481
|
_this.topBar = null;
|
|
@@ -4386,6 +4488,9 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4386
4488
|
_this.isUserActive = false;
|
|
4387
4489
|
_this._onceSeekCanplay = null;
|
|
4388
4490
|
_this._isPauseBeforeSeek = 0;
|
|
4491
|
+
_this.innerStates = {
|
|
4492
|
+
isActiveLocked: false
|
|
4493
|
+
};
|
|
4389
4494
|
var rootInit = _this._initDOM();
|
|
4390
4495
|
if (!rootInit) {
|
|
4391
4496
|
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 +4576,16 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4471
4576
|
this.addClass(STATE_CLASS.NO_START);
|
|
4472
4577
|
}
|
|
4473
4578
|
if (this.config.fluid) {
|
|
4474
|
-
var _this$config3 = this.config,
|
|
4475
|
-
if (typeof
|
|
4476
|
-
|
|
4477
|
-
|
|
4579
|
+
var _this$config3 = this.config, _width = _this$config3.width, _height = _this$config3.height;
|
|
4580
|
+
if (typeof _width !== "number" || typeof _height !== "number") {
|
|
4581
|
+
_width = 600;
|
|
4582
|
+
_height = 337.5;
|
|
4478
4583
|
}
|
|
4479
4584
|
var style = {
|
|
4480
4585
|
width: "100%",
|
|
4481
4586
|
height: "0",
|
|
4482
4587
|
"max-width": "100%",
|
|
4483
|
-
"padding-top": "".concat(
|
|
4588
|
+
"padding-top": "".concat(_height * 100 / _width, "%")
|
|
4484
4589
|
};
|
|
4485
4590
|
Object.keys(style).forEach(function(key) {
|
|
4486
4591
|
_this2.root.style[key] = style[key];
|
|
@@ -4496,6 +4601,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4496
4601
|
}
|
|
4497
4602
|
});
|
|
4498
4603
|
}
|
|
4604
|
+
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;
|
|
4605
|
+
this.sizeInfo.width = width;
|
|
4606
|
+
this.sizeInfo.height = height;
|
|
4607
|
+
this.sizeInfo.left = left;
|
|
4608
|
+
this.sizeInfo.top = top;
|
|
4499
4609
|
return true;
|
|
4500
4610
|
}
|
|
4501
4611
|
}, {
|
|
@@ -4579,7 +4689,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4579
4689
|
var readyState = this.media.readyState;
|
|
4580
4690
|
XG_DEBUG.logInfo("_startInit readyState", readyState);
|
|
4581
4691
|
if (this.config.autoplay) {
|
|
4582
|
-
!
|
|
4692
|
+
!util$1.isMSE(this.media) && this.load();
|
|
4583
4693
|
(sniffer$1.os.isIpad || sniffer$1.os.isPhone) && this.mediaPlay();
|
|
4584
4694
|
}
|
|
4585
4695
|
if (readyState >= 2) {
|
|
@@ -4807,7 +4917,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4807
4917
|
if (!url) {
|
|
4808
4918
|
url = _this8.url || _this8.config.url;
|
|
4809
4919
|
}
|
|
4810
|
-
var
|
|
4920
|
+
var _furl = _this8.preProcessUrl(url);
|
|
4921
|
+
var ret = _this8._startInit(_furl.url);
|
|
4811
4922
|
return ret;
|
|
4812
4923
|
}).catch(function(e3) {
|
|
4813
4924
|
e3.fileName = "player";
|
|
@@ -4824,6 +4935,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
4824
4935
|
if (util$1.typeOf(url) === "Object") {
|
|
4825
4936
|
_src = url.url;
|
|
4826
4937
|
}
|
|
4938
|
+
_src = this.preProcessUrl(_src).url;
|
|
4827
4939
|
var curTime = this.currentTime;
|
|
4828
4940
|
var isPaused = this.paused && !this.isError;
|
|
4829
4941
|
this.src = _src;
|
|
@@ -5162,7 +5274,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5162
5274
|
this.addClass(STATE_CLASS.LOADING);
|
|
5163
5275
|
runHooks(this, "retry", function() {
|
|
5164
5276
|
var cur = _this20.currentTime;
|
|
5165
|
-
|
|
5277
|
+
var url = _this20.config.url;
|
|
5278
|
+
var _srcRet = !util$1.isMSE(_this20.media) ? _this20.preProcessUrl(url) : {
|
|
5279
|
+
url
|
|
5280
|
+
};
|
|
5281
|
+
_this20.src = _srcRet.url;
|
|
5166
5282
|
!_this20.config.isLive && (_this20.currentTime = cur);
|
|
5167
5283
|
_this20.once(CANPLAY, function() {
|
|
5168
5284
|
_this20.mediaPlay();
|
|
@@ -5223,7 +5339,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5223
5339
|
var fullEl = util$1.getFullScreenEl();
|
|
5224
5340
|
if (fullEl === this._fullscreenEl) {
|
|
5225
5341
|
this.onFullscreenChange();
|
|
5226
|
-
return;
|
|
5342
|
+
return Promise.resolve();
|
|
5227
5343
|
}
|
|
5228
5344
|
try {
|
|
5229
5345
|
for (var i2 = 0; i2 < GET_FULLSCREEN_API.length; i2++) {
|
|
@@ -5396,30 +5512,38 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5396
5512
|
key: "onFocus",
|
|
5397
5513
|
value: function onFocus() {
|
|
5398
5514
|
var _this21 = this;
|
|
5399
|
-
var
|
|
5515
|
+
var data = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {
|
|
5516
|
+
autoHide: true,
|
|
5517
|
+
delay: 3e3
|
|
5518
|
+
};
|
|
5519
|
+
var innerStates = this.innerStates;
|
|
5400
5520
|
this.isActive = true;
|
|
5401
5521
|
this.removeClass(STATE_CLASS.INACTIVE);
|
|
5402
5522
|
if (this.userTimer) {
|
|
5403
5523
|
util$1.clearTimeout(this, this.userTimer);
|
|
5404
5524
|
this.userTimer = null;
|
|
5405
5525
|
}
|
|
5406
|
-
if (
|
|
5526
|
+
if (data.isLock !== void 0) {
|
|
5527
|
+
innerStates.isActiveLocked = data.isLock;
|
|
5528
|
+
}
|
|
5529
|
+
if (data.autoHide === false || data.isLock === true || innerStates.isActiveLocked) {
|
|
5407
5530
|
if (this.userTimer) {
|
|
5408
5531
|
util$1.clearTimeout(this, this.userTimer);
|
|
5409
5532
|
this.userTimer = null;
|
|
5410
5533
|
}
|
|
5411
5534
|
return;
|
|
5412
5535
|
}
|
|
5536
|
+
var time = data && data.delay ? data.delay : this.config.inactive;
|
|
5413
5537
|
this.userTimer = util$1.setTimeout(this, function() {
|
|
5414
5538
|
_this21.userTimer = null;
|
|
5415
5539
|
_this21.blur();
|
|
5416
|
-
},
|
|
5540
|
+
}, time);
|
|
5417
5541
|
}
|
|
5418
5542
|
}, {
|
|
5419
5543
|
key: "onBlur",
|
|
5420
5544
|
value: function onBlur() {
|
|
5421
|
-
var
|
|
5422
|
-
if (!this.isActive) {
|
|
5545
|
+
var _ref = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, _ref$ignorePaused = _ref.ignorePaused, ignorePaused = _ref$ignorePaused === void 0 ? false : _ref$ignorePaused;
|
|
5546
|
+
if (!this.isActive || this.innerStates.isActiveLocked) {
|
|
5423
5547
|
return;
|
|
5424
5548
|
}
|
|
5425
5549
|
var closePauseVideoFocus = this.config.closePauseVideoFocus;
|
|
@@ -5542,7 +5666,7 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5542
5666
|
}, {
|
|
5543
5667
|
key: "onTimeupdate",
|
|
5544
5668
|
value: function onTimeupdate() {
|
|
5545
|
-
!this._videoHeight && this.resize();
|
|
5669
|
+
!this._videoHeight && this.media.videoHeight && this.resize();
|
|
5546
5670
|
if ((this.waitTimer || this.hasClass(STATE_CLASS.LOADING)) && this.media.readyState > 2) {
|
|
5547
5671
|
this.removeClass(STATE_CLASS.LOADING);
|
|
5548
5672
|
util$1.clearTimeout(this, this.waitTimer);
|
|
@@ -5617,8 +5741,11 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5617
5741
|
key: "resizePosition",
|
|
5618
5742
|
value: function resizePosition() {
|
|
5619
5743
|
var _this$videoPos = this.videoPos, rotate = _this$videoPos.rotate, vy = _this$videoPos.vy, vx = _this$videoPos.vx, h2 = _this$videoPos.h, w2 = _this$videoPos.w;
|
|
5744
|
+
if (rotate < 0 && !vy && !vx) {
|
|
5745
|
+
return;
|
|
5746
|
+
}
|
|
5620
5747
|
var _pi = this.videoPos._pi;
|
|
5621
|
-
if (!_pi) {
|
|
5748
|
+
if (!_pi && this.media.videoHeight) {
|
|
5622
5749
|
_pi = this.media.videoWidth / this.media.videoHeight * 100;
|
|
5623
5750
|
}
|
|
5624
5751
|
if (!_pi) {
|
|
@@ -5718,9 +5845,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5718
5845
|
if (!this.media) {
|
|
5719
5846
|
return;
|
|
5720
5847
|
}
|
|
5848
|
+
var containerSize = this.root.getBoundingClientRect();
|
|
5849
|
+
this.sizeInfo.width = containerSize.width;
|
|
5850
|
+
this.sizeInfo.height = containerSize.height;
|
|
5851
|
+
this.sizeInfo.left = containerSize.left;
|
|
5852
|
+
this.sizeInfo.top = containerSize.top;
|
|
5721
5853
|
var _this$media = this.media, videoWidth = _this$media.videoWidth, videoHeight = _this$media.videoHeight;
|
|
5722
5854
|
var _this$config6 = this.config, fitVideoSize = _this$config6.fitVideoSize, videoFillMode = _this$config6.videoFillMode;
|
|
5723
|
-
if (videoFillMode === "fill" || videoFillMode === "cover") {
|
|
5855
|
+
if (videoFillMode === "fill" || videoFillMode === "cover" || videoFillMode === "contain") {
|
|
5724
5856
|
this.setAttribute("data-xgfill", videoFillMode);
|
|
5725
5857
|
}
|
|
5726
5858
|
if (!videoHeight || !videoWidth) {
|
|
@@ -5728,7 +5860,6 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5728
5860
|
}
|
|
5729
5861
|
this._videoHeight = videoHeight;
|
|
5730
5862
|
this._videoWidth = videoWidth;
|
|
5731
|
-
var containerSize = this.root.getBoundingClientRect();
|
|
5732
5863
|
var controlsHeight = this.controls && this.innerContainer ? this.controls.root.getBoundingClientRect().height : 0;
|
|
5733
5864
|
var width = containerSize.width;
|
|
5734
5865
|
var height = containerSize.height - controlsHeight;
|
|
@@ -5783,6 +5914,14 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5783
5914
|
XG_DEBUG.logInfo("setState", "state from:".concat(STATE_ARRAY[this.state], " to:").concat(STATE_ARRAY[newState]));
|
|
5784
5915
|
this._state = newState;
|
|
5785
5916
|
}
|
|
5917
|
+
}, {
|
|
5918
|
+
key: "preProcessUrl",
|
|
5919
|
+
value: function preProcessUrl(url, ext) {
|
|
5920
|
+
var preProcessUrl2 = this.config.preProcessUrl;
|
|
5921
|
+
return !util$1.isBlob(url) && preProcessUrl2 && typeof preProcessUrl2 === "function" ? preProcessUrl2(url, ext) : {
|
|
5922
|
+
url
|
|
5923
|
+
};
|
|
5924
|
+
}
|
|
5786
5925
|
}, {
|
|
5787
5926
|
key: "state",
|
|
5788
5927
|
get: function get() {
|
|
@@ -5956,9 +6095,8 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5956
6095
|
}, {
|
|
5957
6096
|
key: "cumulateTime",
|
|
5958
6097
|
get: function get() {
|
|
5959
|
-
var _accPlayed = this._accPlayed;
|
|
5960
|
-
|
|
5961
|
-
return _accPlayed.acc;
|
|
6098
|
+
var _this$_accPlayed = this._accPlayed, acc = _this$_accPlayed.acc, t2 = _this$_accPlayed.t;
|
|
6099
|
+
return t2 ? (/* @__PURE__ */ new Date()).getTime() - t2 + acc : acc;
|
|
5962
6100
|
}
|
|
5963
6101
|
}, {
|
|
5964
6102
|
key: "zoom",
|
|
@@ -5997,6 +6135,22 @@ var Player = /* @__PURE__ */ function(_MediaProxy) {
|
|
|
5997
6135
|
set: function set(val) {
|
|
5998
6136
|
REAL_TIME_SPEED = val;
|
|
5999
6137
|
}
|
|
6138
|
+
}, {
|
|
6139
|
+
key: "offsetCurrentTime",
|
|
6140
|
+
get: function get() {
|
|
6141
|
+
return this._offsetInfo.currentTime || 0;
|
|
6142
|
+
},
|
|
6143
|
+
set: function set(val) {
|
|
6144
|
+
this._offsetInfo.currentTime = val;
|
|
6145
|
+
}
|
|
6146
|
+
}, {
|
|
6147
|
+
key: "offsetDuration",
|
|
6148
|
+
get: function get() {
|
|
6149
|
+
return this._offsetInfo.duration || 0;
|
|
6150
|
+
},
|
|
6151
|
+
set: function set(val) {
|
|
6152
|
+
this._offsetInfo.duration = val || 0;
|
|
6153
|
+
}
|
|
6000
6154
|
}, {
|
|
6001
6155
|
key: "hook",
|
|
6002
6156
|
value: function hook$1(hookName, handler) {
|
|
@@ -6127,7 +6281,7 @@ var ErrorCode$1 = /* @__PURE__ */ ((ErrorCode2) => {
|
|
|
6127
6281
|
ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
|
|
6128
6282
|
ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
|
|
6129
6283
|
ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
|
|
6130
|
-
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] =
|
|
6284
|
+
ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
|
|
6131
6285
|
ErrorCode2["UNKNOWN"] = "UNKNOWN";
|
|
6132
6286
|
return ErrorCode2;
|
|
6133
6287
|
})(ErrorCode$1 || {});
|
|
@@ -6224,7 +6378,7 @@ const ERROR_INFO = {
|
|
|
6224
6378
|
/* Error */
|
|
6225
6379
|
},
|
|
6226
6380
|
[
|
|
6227
|
-
|
|
6381
|
+
110
|
|
6228
6382
|
/* MODULE_LOAD_ERROR */
|
|
6229
6383
|
]: {
|
|
6230
6384
|
messageTextKey: "MODULE_LOAD_ERROR",
|
|
@@ -6299,6 +6453,11 @@ const ERROR_TYPE_INFO = {
|
|
|
6299
6453
|
}
|
|
6300
6454
|
};
|
|
6301
6455
|
let VeError$1 = class VeError extends Error {
|
|
6456
|
+
/**
|
|
6457
|
+
* @hidden
|
|
6458
|
+
* @param error
|
|
6459
|
+
* @param i18n
|
|
6460
|
+
*/
|
|
6302
6461
|
constructor(error2, i18n) {
|
|
6303
6462
|
var _a;
|
|
6304
6463
|
const errorInfo = typeof error2 === "string" ? {
|
|
@@ -6306,8 +6465,17 @@ let VeError$1 = class VeError extends Error {
|
|
|
6306
6465
|
} : error2;
|
|
6307
6466
|
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"));
|
|
6308
6467
|
super(message);
|
|
6468
|
+
/**
|
|
6469
|
+
* @brief 错误码,对应[错误码字典](#错误码)。
|
|
6470
|
+
*/
|
|
6309
6471
|
__publicField(this, "errorCode");
|
|
6472
|
+
/**
|
|
6473
|
+
* @brief 错误等级。
|
|
6474
|
+
*/
|
|
6310
6475
|
__publicField(this, "level");
|
|
6476
|
+
/**
|
|
6477
|
+
* @brief 其他错误信息。
|
|
6478
|
+
*/
|
|
6311
6479
|
__publicField(this, "ext");
|
|
6312
6480
|
this.errorCode = (errorInfo == null ? void 0 : errorInfo.errorCode) ?? "UNKNOWN";
|
|
6313
6481
|
this.level = (errorInfo == null ? void 0 : errorInfo.level) ?? "Error";
|
|
@@ -7655,10 +7823,56 @@ function getDefaultConfig() {
|
|
|
7655
7823
|
var Touche = /* @__PURE__ */ function() {
|
|
7656
7824
|
function Touche2(dom) {
|
|
7657
7825
|
var _this = this;
|
|
7658
|
-
var
|
|
7826
|
+
var _config = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {
|
|
7659
7827
|
eventType: "touch"
|
|
7660
7828
|
};
|
|
7661
7829
|
_classCallCheck(this, Touche2);
|
|
7830
|
+
_defineProperty$1(this, "onTouchStart", function(e3) {
|
|
7831
|
+
var _pos = _this._pos, root2 = _this.root;
|
|
7832
|
+
var touch = getTouch(e3.touches);
|
|
7833
|
+
_pos.x = touch ? parseInt(touch.pageX, 10) : e3.pageX;
|
|
7834
|
+
_pos.y = touch ? parseInt(touch.pageX, 10) : e3.pageX;
|
|
7835
|
+
_pos.start = true;
|
|
7836
|
+
_this.__setPress(e3);
|
|
7837
|
+
root2.addEventListener(_this.events.end, _this.onTouchEnd);
|
|
7838
|
+
root2.addEventListener(_this.events.cancel, _this.onTouchCancel);
|
|
7839
|
+
root2.addEventListener(_this.events.move, _this.onTouchMove);
|
|
7840
|
+
_this.trigger(EVENTS.TOUCH_START, e3);
|
|
7841
|
+
});
|
|
7842
|
+
_defineProperty$1(this, "onTouchCancel", function(e3) {
|
|
7843
|
+
_this.onTouchEnd(e3);
|
|
7844
|
+
});
|
|
7845
|
+
_defineProperty$1(this, "onTouchEnd", function(e3) {
|
|
7846
|
+
var _pos = _this._pos, root2 = _this.root;
|
|
7847
|
+
_this.__clearPress();
|
|
7848
|
+
root2.removeEventListener(_this.events.cancel, _this.onTouchCancel);
|
|
7849
|
+
root2.removeEventListener(_this.events.end, _this.onTouchEnd);
|
|
7850
|
+
root2.removeEventListener(_this.events.move, _this.onTouchMove);
|
|
7851
|
+
e3.moving = _pos.moving;
|
|
7852
|
+
e3.press = _pos.press;
|
|
7853
|
+
_pos.press && _this.trigger(EVENTS.PRESS_END, e3);
|
|
7854
|
+
_this.trigger(EVENTS.TOUCH_END, e3);
|
|
7855
|
+
!_pos.press && !_pos.moving && _this.__setDb(e3);
|
|
7856
|
+
_pos.press = false;
|
|
7857
|
+
_pos.start = false;
|
|
7858
|
+
_pos.moving = false;
|
|
7859
|
+
});
|
|
7860
|
+
_defineProperty$1(this, "onTouchMove", function(e3) {
|
|
7861
|
+
var _pos = _this._pos, config = _this.config;
|
|
7862
|
+
var touch = getTouch(e3.touches);
|
|
7863
|
+
var x2 = touch ? parseInt(touch.pageX, 10) : e3.pageX;
|
|
7864
|
+
var y2 = touch ? parseInt(touch.pageY, 10) : e3.pageX;
|
|
7865
|
+
var diffx = x2 - _pos.x;
|
|
7866
|
+
var diffy = y2 - _pos.y;
|
|
7867
|
+
if (Math.abs(diffy) < config.miniStep && Math.abs(diffx) < config.miniStep) {
|
|
7868
|
+
return;
|
|
7869
|
+
}
|
|
7870
|
+
_this.__clearPress();
|
|
7871
|
+
_pos.press && _this.trigger(EVENTS.PRESS_END, e3);
|
|
7872
|
+
_pos.press = false;
|
|
7873
|
+
_pos.moving = true;
|
|
7874
|
+
_this.trigger(EVENTS.TOUCH_MOVE, e3);
|
|
7875
|
+
});
|
|
7662
7876
|
this._pos = {
|
|
7663
7877
|
moving: false,
|
|
7664
7878
|
start: false,
|
|
@@ -7666,11 +7880,11 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7666
7880
|
y: 0
|
|
7667
7881
|
};
|
|
7668
7882
|
this.config = getDefaultConfig();
|
|
7669
|
-
Object.keys(
|
|
7670
|
-
_this.config[key] =
|
|
7883
|
+
Object.keys(_config).map(function(key) {
|
|
7884
|
+
_this.config[key] = _config[key];
|
|
7671
7885
|
});
|
|
7672
7886
|
this.root = dom;
|
|
7673
|
-
this.events =
|
|
7887
|
+
this.events = _config.eventType === "mouse" ? MOUSES : TOUCHS;
|
|
7674
7888
|
this.pressIntrvalId = null;
|
|
7675
7889
|
this.dbIntrvalId = null;
|
|
7676
7890
|
this.__handlers = {};
|
|
@@ -7679,10 +7893,6 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7679
7893
|
_createClass$1(Touche2, [{
|
|
7680
7894
|
key: "_initEvent",
|
|
7681
7895
|
value: function _initEvent() {
|
|
7682
|
-
this.onTouchStart = this.onTouchStart.bind(this);
|
|
7683
|
-
this.onTouchMove = this.onTouchMove.bind(this);
|
|
7684
|
-
this.onTouchEnd = this.onTouchEnd.bind(this);
|
|
7685
|
-
this.onTouchCancel = this.onTouchCancel.bind(this);
|
|
7686
7896
|
this.root.addEventListener(this.events.start, this.onTouchStart);
|
|
7687
7897
|
}
|
|
7688
7898
|
}, {
|
|
@@ -7768,60 +7978,6 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7768
7978
|
}
|
|
7769
7979
|
});
|
|
7770
7980
|
}
|
|
7771
|
-
}, {
|
|
7772
|
-
key: "onTouchStart",
|
|
7773
|
-
value: function onTouchStart(e3) {
|
|
7774
|
-
var _pos = this._pos, root2 = this.root;
|
|
7775
|
-
var touch = getTouch(e3.touches);
|
|
7776
|
-
_pos.x = touch ? parseInt(touch.pageX, 10) : e3.pageX;
|
|
7777
|
-
_pos.y = touch ? parseInt(touch.pageX, 10) : e3.pageX;
|
|
7778
|
-
_pos.start = true;
|
|
7779
|
-
this.__setPress(e3);
|
|
7780
|
-
root2.addEventListener(this.events.end, this.onTouchEnd);
|
|
7781
|
-
root2.addEventListener(this.events.cancel, this.onTouchCancel);
|
|
7782
|
-
root2.addEventListener(this.events.move, this.onTouchMove);
|
|
7783
|
-
this.trigger(EVENTS.TOUCH_START, e3);
|
|
7784
|
-
}
|
|
7785
|
-
}, {
|
|
7786
|
-
key: "onTouchCancel",
|
|
7787
|
-
value: function onTouchCancel(e3) {
|
|
7788
|
-
this.onTouchEnd(e3);
|
|
7789
|
-
}
|
|
7790
|
-
}, {
|
|
7791
|
-
key: "onTouchEnd",
|
|
7792
|
-
value: function onTouchEnd(e3) {
|
|
7793
|
-
var _pos = this._pos, root2 = this.root;
|
|
7794
|
-
this.__clearPress();
|
|
7795
|
-
root2.removeEventListener(this.events.cancel, this.onTouchCancel);
|
|
7796
|
-
root2.removeEventListener(this.events.end, this.onTouchEnd);
|
|
7797
|
-
root2.removeEventListener(this.events.move, this.onTouchMove);
|
|
7798
|
-
e3.moving = _pos.moving;
|
|
7799
|
-
e3.press = _pos.press;
|
|
7800
|
-
_pos.press && this.trigger(EVENTS.PRESS_END, e3);
|
|
7801
|
-
this.trigger(EVENTS.TOUCH_END, e3);
|
|
7802
|
-
!_pos.press && !_pos.moving && this.__setDb(e3);
|
|
7803
|
-
_pos.press = false;
|
|
7804
|
-
_pos.start = false;
|
|
7805
|
-
_pos.moving = false;
|
|
7806
|
-
}
|
|
7807
|
-
}, {
|
|
7808
|
-
key: "onTouchMove",
|
|
7809
|
-
value: function onTouchMove(e3) {
|
|
7810
|
-
var _pos = this._pos, config = this.config;
|
|
7811
|
-
var touch = getTouch(e3.touches);
|
|
7812
|
-
var x2 = touch ? parseInt(touch.pageX, 10) : e3.pageX;
|
|
7813
|
-
var y2 = touch ? parseInt(touch.pageY, 10) : e3.pageX;
|
|
7814
|
-
var diffx = x2 - _pos.x;
|
|
7815
|
-
var diffy = y2 - _pos.y;
|
|
7816
|
-
if (Math.abs(diffy) < config.miniStep && Math.abs(diffx) < config.miniStep) {
|
|
7817
|
-
return;
|
|
7818
|
-
}
|
|
7819
|
-
this.__clearPress();
|
|
7820
|
-
_pos.press && this.trigger(EVENTS.PRESS_END, e3);
|
|
7821
|
-
_pos.press = false;
|
|
7822
|
-
_pos.moving = true;
|
|
7823
|
-
this.trigger(EVENTS.TOUCH_MOVE, e3);
|
|
7824
|
-
}
|
|
7825
7981
|
}, {
|
|
7826
7982
|
key: "destroy",
|
|
7827
7983
|
value: function destroy2() {
|
|
@@ -7831,8 +7987,8 @@ var Touche = /* @__PURE__ */ function() {
|
|
|
7831
7987
|
touchmove: "onTouchMove",
|
|
7832
7988
|
touchstart: "onTouchStart"
|
|
7833
7989
|
};
|
|
7834
|
-
Object.keys(map).
|
|
7835
|
-
_this4.root.removeEventListener(
|
|
7990
|
+
Object.keys(map).forEach(function(key) {
|
|
7991
|
+
_this4.root.removeEventListener(key, _this4[map[key]]);
|
|
7836
7992
|
});
|
|
7837
7993
|
}
|
|
7838
7994
|
}]);
|
|
@@ -8483,38 +8639,61 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8483
8639
|
}
|
|
8484
8640
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
8485
8641
|
_defineProperty$1(_assertThisInitialized(_this), "onBodyKeyDown", function(event) {
|
|
8486
|
-
|
|
8487
|
-
if (!_this.player || !_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
8642
|
+
if (!_this.player) {
|
|
8488
8643
|
return;
|
|
8489
8644
|
}
|
|
8490
|
-
|
|
8645
|
+
var e3 = event || window.event;
|
|
8646
|
+
var keyCode = e3.keyCode;
|
|
8647
|
+
var _assertThisInitialize = _assertThisInitialized(_this), _keyState = _assertThisInitialize._keyState, player = _assertThisInitialize.player;
|
|
8648
|
+
var _this$config = _this.config, disable = _this$config.disable, disableBodyTrigger = _this$config.disableBodyTrigger, isIgnoreUserActive = _this$config.isIgnoreUserActive;
|
|
8649
|
+
if (disable || disableBodyTrigger || !player.isUserActive && !isIgnoreUserActive || isDisableTag(e3.target) || !_this.checkIsVisible() || e3.metaKey || e3.altKey || e3.ctrlKey) {
|
|
8650
|
+
_keyState.isBodyKeyDown = false;
|
|
8491
8651
|
return;
|
|
8492
8652
|
}
|
|
8493
|
-
|
|
8494
|
-
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
|
|
8653
|
+
if (!event.repeat && !_keyState.isKeyDown) {
|
|
8654
|
+
if ((e3.target === document.body || _this.config.isGlobalTrigger && !isDisableTag(e3.target)) && _this.checkCode(keyCode, true)) {
|
|
8655
|
+
_keyState.isBodyKeyDown = true;
|
|
8656
|
+
}
|
|
8657
|
+
document.addEventListener("keyup", _this.onBodyKeyUp);
|
|
8498
8658
|
}
|
|
8499
|
-
|
|
8659
|
+
_keyState.isBodyKeyDown && _this.handleKeyDown(e3);
|
|
8500
8660
|
});
|
|
8501
|
-
_defineProperty$1(_assertThisInitialized(_this), "
|
|
8502
|
-
|
|
8503
|
-
if (_this.config.disable || _this.config.disableRootTrigger || e3.metaKey || e3.altKey || e3.ctrlKey) {
|
|
8661
|
+
_defineProperty$1(_assertThisInitialized(_this), "onBodyKeyUp", function(event) {
|
|
8662
|
+
if (!_this.player) {
|
|
8504
8663
|
return;
|
|
8505
8664
|
}
|
|
8506
|
-
|
|
8665
|
+
document.removeEventListener("keyup", _this.onBodyKeyUp);
|
|
8666
|
+
_this.handleKeyUp(event);
|
|
8667
|
+
});
|
|
8668
|
+
_defineProperty$1(_assertThisInitialized(_this), "onKeydown", function(event) {
|
|
8669
|
+
if (!_this.player) {
|
|
8507
8670
|
return;
|
|
8508
8671
|
}
|
|
8509
|
-
|
|
8672
|
+
var e3 = event || window.event;
|
|
8673
|
+
var _assertThisInitialize2 = _assertThisInitialized(_this), _keyState = _assertThisInitialize2._keyState;
|
|
8674
|
+
if (!e3.repeat) {
|
|
8675
|
+
if (_this.config.disable || _this.config.disableRootTrigger || e3.metaKey || e3.altKey || e3.ctrlKey) {
|
|
8676
|
+
return;
|
|
8677
|
+
}
|
|
8678
|
+
if (!_this.player.isUserActive && !_this.config.isIgnoreUserActive) {
|
|
8679
|
+
return;
|
|
8680
|
+
}
|
|
8681
|
+
if (e3 && (e3.keyCode === 37 || _this.checkCode(e3.keyCode)) && (e3.target === _this.player.root || e3.target === _this.player.video || e3.target === _this.player.controls.el)) {
|
|
8682
|
+
_keyState.isKeyDown = true;
|
|
8683
|
+
}
|
|
8684
|
+
_this.player.root.addEventListener("keyup", _this.onKeyup);
|
|
8685
|
+
}
|
|
8686
|
+
if (!_keyState.isKeyDown) {
|
|
8510
8687
|
return;
|
|
8511
8688
|
}
|
|
8512
|
-
|
|
8513
|
-
|
|
8514
|
-
|
|
8515
|
-
|
|
8689
|
+
_this.handleKeyDown(e3);
|
|
8690
|
+
});
|
|
8691
|
+
_defineProperty$1(_assertThisInitialized(_this), "onKeyup", function(event) {
|
|
8692
|
+
if (!_this.player) {
|
|
8693
|
+
return;
|
|
8516
8694
|
}
|
|
8517
|
-
_this.
|
|
8695
|
+
_this.player.root.removeEventListener("keyup", _this.onKeyup);
|
|
8696
|
+
_this.handleKeyUp(event);
|
|
8518
8697
|
});
|
|
8519
8698
|
return _this;
|
|
8520
8699
|
}
|
|
@@ -8528,7 +8707,7 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8528
8707
|
if (!_this2.keyCodeMap[key]) {
|
|
8529
8708
|
_this2.keyCodeMap[key] = extendkeyCodeMap[key];
|
|
8530
8709
|
} else {
|
|
8531
|
-
["keyCode", "action", "disable", "isBodyTarget"].map(function(key1) {
|
|
8710
|
+
["keyCode", "action", "disable", "pressAction", "disablePress", "isBodyTarget"].map(function(key1) {
|
|
8532
8711
|
extendkeyCodeMap[key][key1] && (_this2.keyCodeMap[key][key1] = extendkeyCodeMap[key][key1]);
|
|
8533
8712
|
});
|
|
8534
8713
|
}
|
|
@@ -8548,37 +8727,51 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8548
8727
|
keyCode: 32,
|
|
8549
8728
|
action: "playPause",
|
|
8550
8729
|
disable: false,
|
|
8730
|
+
disablePress: false,
|
|
8551
8731
|
noBodyTarget: false
|
|
8552
8732
|
},
|
|
8553
8733
|
up: {
|
|
8554
8734
|
keyCode: 38,
|
|
8555
8735
|
action: "upVolume",
|
|
8556
8736
|
disable: false,
|
|
8737
|
+
disablePress: false,
|
|
8557
8738
|
noBodyTarget: true
|
|
8558
8739
|
},
|
|
8559
8740
|
down: {
|
|
8560
8741
|
keyCode: 40,
|
|
8561
8742
|
action: "downVolume",
|
|
8562
8743
|
disable: false,
|
|
8744
|
+
disablePress: false,
|
|
8563
8745
|
noBodyTarget: true
|
|
8564
8746
|
},
|
|
8565
8747
|
left: {
|
|
8566
8748
|
keyCode: 37,
|
|
8567
8749
|
action: "seekBack",
|
|
8750
|
+
disablePress: false,
|
|
8568
8751
|
disable: false
|
|
8569
8752
|
},
|
|
8570
8753
|
right: {
|
|
8571
8754
|
keyCode: 39,
|
|
8572
8755
|
action: "seek",
|
|
8756
|
+
pressAction: "changePlaybackRate",
|
|
8757
|
+
disablePress: false,
|
|
8573
8758
|
disable: false
|
|
8574
8759
|
},
|
|
8575
8760
|
esc: {
|
|
8576
8761
|
keyCode: 27,
|
|
8577
8762
|
action: "exitFullscreen",
|
|
8763
|
+
disablePress: true,
|
|
8578
8764
|
disable: false
|
|
8579
8765
|
}
|
|
8580
8766
|
};
|
|
8581
8767
|
this.mergekeyCodeMap();
|
|
8768
|
+
this._keyState = {
|
|
8769
|
+
isKeyDown: false,
|
|
8770
|
+
isBodyKeyDown: false,
|
|
8771
|
+
isPress: false,
|
|
8772
|
+
tt: 0,
|
|
8773
|
+
playbackRate: 0
|
|
8774
|
+
};
|
|
8582
8775
|
this.player.root.addEventListener("keydown", this.onKeydown);
|
|
8583
8776
|
document.addEventListener("keydown", this.onBodyKeyDown);
|
|
8584
8777
|
}
|
|
@@ -8612,6 +8805,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8612
8805
|
key: "downVolume",
|
|
8613
8806
|
value: function downVolume(event) {
|
|
8614
8807
|
var player = this.player;
|
|
8808
|
+
if (player.volume <= 0) {
|
|
8809
|
+
return;
|
|
8810
|
+
}
|
|
8615
8811
|
var val = parseFloat((player.volume - 0.1).toFixed(1));
|
|
8616
8812
|
var props = {
|
|
8617
8813
|
volume: {
|
|
@@ -8632,6 +8828,9 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8632
8828
|
key: "upVolume",
|
|
8633
8829
|
value: function upVolume(event) {
|
|
8634
8830
|
var player = this.player;
|
|
8831
|
+
if (player.volume >= 1) {
|
|
8832
|
+
return;
|
|
8833
|
+
}
|
|
8635
8834
|
var val = parseFloat((player.volume + 0.1).toFixed(1));
|
|
8636
8835
|
var props = {
|
|
8637
8836
|
volume: {
|
|
@@ -8651,42 +8850,57 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8651
8850
|
}, {
|
|
8652
8851
|
key: "seek",
|
|
8653
8852
|
value: function seek(event) {
|
|
8654
|
-
var _this$player = this.player, currentTime = _this$player.currentTime, duration = _this$player.duration;
|
|
8655
|
-
var _time = currentTime;
|
|
8656
|
-
|
|
8657
|
-
|
|
8853
|
+
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;
|
|
8854
|
+
var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
|
|
8855
|
+
var _duration = offsetDuration || duration;
|
|
8856
|
+
var _step = event.repeat && this.seekStep >= 4 ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
8857
|
+
if (_time + _step <= _duration) {
|
|
8858
|
+
_time = _time + _step;
|
|
8658
8859
|
} else {
|
|
8659
|
-
_time =
|
|
8860
|
+
_time = _duration;
|
|
8660
8861
|
}
|
|
8862
|
+
var _seekTime = util$1.getCurrentTimeByOffset(_time, timeSegments);
|
|
8661
8863
|
var props = {
|
|
8662
8864
|
currentTime: {
|
|
8663
8865
|
from: currentTime,
|
|
8664
|
-
to:
|
|
8866
|
+
to: _seekTime
|
|
8665
8867
|
}
|
|
8666
8868
|
};
|
|
8667
8869
|
this.emitUserAction(event, "seek", {
|
|
8668
8870
|
props
|
|
8669
8871
|
});
|
|
8670
|
-
this.player.currentTime =
|
|
8872
|
+
this.player.currentTime = _seekTime;
|
|
8671
8873
|
}
|
|
8672
8874
|
}, {
|
|
8673
8875
|
key: "seekBack",
|
|
8674
8876
|
value: function seekBack(event) {
|
|
8675
|
-
var
|
|
8676
|
-
var
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8877
|
+
var _this$player2 = this.player, currentTime = _this$player2.currentTime, offsetCurrentTime = _this$player2.offsetCurrentTime, timeSegments = _this$player2.timeSegments;
|
|
8878
|
+
var _step = event.repeat ? parseInt(this.seekStep / 2, 10) : this.seekStep;
|
|
8879
|
+
var _time = offsetCurrentTime > -1 ? offsetCurrentTime : currentTime;
|
|
8880
|
+
var _seekTime = _time - _step;
|
|
8881
|
+
if (_seekTime < 0) {
|
|
8882
|
+
_seekTime = 0;
|
|
8883
|
+
}
|
|
8884
|
+
_seekTime = util$1.getCurrentTimeByOffset(_seekTime, timeSegments);
|
|
8680
8885
|
var props = {
|
|
8681
8886
|
currentTime: {
|
|
8682
8887
|
from: currentTime,
|
|
8683
|
-
to:
|
|
8888
|
+
to: _seekTime
|
|
8684
8889
|
}
|
|
8685
8890
|
};
|
|
8686
8891
|
this.emitUserAction(event, "seek", {
|
|
8687
8892
|
props
|
|
8688
8893
|
});
|
|
8689
|
-
this.player.currentTime =
|
|
8894
|
+
this.player.currentTime = _seekTime;
|
|
8895
|
+
}
|
|
8896
|
+
}, {
|
|
8897
|
+
key: "changePlaybackRate",
|
|
8898
|
+
value: function changePlaybackRate(event) {
|
|
8899
|
+
var _keyState = this._keyState, config = this.config, player = this.player;
|
|
8900
|
+
if (_keyState.playbackRate === 0) {
|
|
8901
|
+
_keyState.playbackRate = player.playbackRate;
|
|
8902
|
+
player.playbackRate = config.playbackRate;
|
|
8903
|
+
}
|
|
8690
8904
|
}
|
|
8691
8905
|
}, {
|
|
8692
8906
|
key: "playPause",
|
|
@@ -8724,32 +8938,66 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8724
8938
|
player.exitCssFullscreen();
|
|
8725
8939
|
}
|
|
8726
8940
|
}
|
|
8941
|
+
}, {
|
|
8942
|
+
key: "handleKeyDown",
|
|
8943
|
+
value: function handleKeyDown(e3) {
|
|
8944
|
+
var _keyState = this._keyState;
|
|
8945
|
+
if (e3.repeat) {
|
|
8946
|
+
_keyState.isPress = true;
|
|
8947
|
+
var _t = Date.now();
|
|
8948
|
+
if (_t - _keyState.tt < 200) {
|
|
8949
|
+
return;
|
|
8950
|
+
}
|
|
8951
|
+
_keyState.tt = _t;
|
|
8952
|
+
}
|
|
8953
|
+
preventDefault(e3);
|
|
8954
|
+
this.handleKeyCode(e3.keyCode, e3, _keyState.isPress);
|
|
8955
|
+
}
|
|
8956
|
+
}, {
|
|
8957
|
+
key: "handleKeyUp",
|
|
8958
|
+
value: function handleKeyUp(e3) {
|
|
8959
|
+
var _keyState = this._keyState;
|
|
8960
|
+
if (_keyState.playbackRate > 0) {
|
|
8961
|
+
this.player.playbackRate = _keyState.playbackRate;
|
|
8962
|
+
_keyState.playbackRate = 0;
|
|
8963
|
+
}
|
|
8964
|
+
_keyState.isKeyDown = false;
|
|
8965
|
+
_keyState.isPress = false;
|
|
8966
|
+
_keyState.tt = 0;
|
|
8967
|
+
}
|
|
8727
8968
|
}, {
|
|
8728
8969
|
key: "handleKeyCode",
|
|
8729
|
-
value: function handleKeyCode(curKeyCode, event) {
|
|
8730
|
-
var
|
|
8731
|
-
|
|
8732
|
-
var
|
|
8733
|
-
if (keyCode === curKeyCode
|
|
8734
|
-
if (
|
|
8735
|
-
action
|
|
8736
|
-
|
|
8737
|
-
|
|
8738
|
-
|
|
8970
|
+
value: function handleKeyCode(curKeyCode, event, isPress) {
|
|
8971
|
+
var arr = Object.keys(this.keyCodeMap);
|
|
8972
|
+
for (var i2 = 0; i2 < arr.length; i2++) {
|
|
8973
|
+
var _this$keyCodeMap$arr$ = this.keyCodeMap[arr[i2]], 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;
|
|
8974
|
+
if (keyCode === curKeyCode) {
|
|
8975
|
+
if (!disable && !(isPress && disablePress)) {
|
|
8976
|
+
var _action = !isPress ? action : pressAction || action;
|
|
8977
|
+
if (typeof _action === "function") {
|
|
8978
|
+
action(event, this.player, isPress);
|
|
8979
|
+
} else if (typeof _action === "string") {
|
|
8980
|
+
if (typeof this[_action] === "function") {
|
|
8981
|
+
this[_action](event, this.player, isPress);
|
|
8982
|
+
}
|
|
8739
8983
|
}
|
|
8984
|
+
this.emit(SHORTCUT, _objectSpread2$1({
|
|
8985
|
+
key: arr[i2],
|
|
8986
|
+
target: event.target,
|
|
8987
|
+
isPress
|
|
8988
|
+
}, this.keyCodeMap[arr[i2]]));
|
|
8740
8989
|
}
|
|
8741
|
-
|
|
8742
|
-
key,
|
|
8743
|
-
target: event.target
|
|
8744
|
-
}, _this4.keyCodeMap[key]));
|
|
8990
|
+
break;
|
|
8745
8991
|
}
|
|
8746
|
-
}
|
|
8992
|
+
}
|
|
8747
8993
|
}
|
|
8748
8994
|
}, {
|
|
8749
8995
|
key: "destroy",
|
|
8750
8996
|
value: function destroy2() {
|
|
8751
8997
|
this.player.root.removeEventListener("keydown", this.onKeydown);
|
|
8752
8998
|
document.removeEventListener("keydown", this.onBodyKeyDown);
|
|
8999
|
+
this.player.root.removeEventListener("keyup", this.onKeyup);
|
|
9000
|
+
document.removeEventListener("keyup", this.onBodyKeyUp);
|
|
8753
9001
|
}
|
|
8754
9002
|
}, {
|
|
8755
9003
|
key: "disable",
|
|
@@ -8771,12 +9019,13 @@ var Keyboard = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8771
9019
|
get: function get() {
|
|
8772
9020
|
return {
|
|
8773
9021
|
seekStep: 10,
|
|
8774
|
-
checkVisible:
|
|
9022
|
+
checkVisible: false,
|
|
8775
9023
|
disableBodyTrigger: false,
|
|
8776
9024
|
disableRootTrigger: false,
|
|
8777
9025
|
isGlobalTrigger: false,
|
|
8778
9026
|
keyCodeMap: {},
|
|
8779
9027
|
disable: false,
|
|
9028
|
+
playbackRate: 2,
|
|
8780
9029
|
isIgnoreUserActive: false
|
|
8781
9030
|
};
|
|
8782
9031
|
}
|
|
@@ -10145,6 +10394,9 @@ class Definition {
|
|
|
10145
10394
|
get url() {
|
|
10146
10395
|
return this._currentUrlRef.url;
|
|
10147
10396
|
}
|
|
10397
|
+
set url(url) {
|
|
10398
|
+
this._currentUrlRef.url = url;
|
|
10399
|
+
}
|
|
10148
10400
|
next() {
|
|
10149
10401
|
const next = this._currentUrlRef.next;
|
|
10150
10402
|
/* istanbul ignore next -- @preserve */
|
|
@@ -10222,7 +10474,6 @@ class SourceManager {
|
|
|
10222
10474
|
__publicField(this, "defaultSource");
|
|
10223
10475
|
__publicField(this, "defaultDefinition");
|
|
10224
10476
|
__publicField(this, "maxFallbackRound");
|
|
10225
|
-
__publicField(this, "_prepareList", []);
|
|
10226
10477
|
__publicField(this, "_currentDefinition");
|
|
10227
10478
|
__publicField(this, "_sources");
|
|
10228
10479
|
__publicField(this, "_fallbackCount", 0);
|
|
@@ -10257,6 +10508,11 @@ class SourceManager {
|
|
|
10257
10508
|
var _a;
|
|
10258
10509
|
return (_a = this.definition) == null ? void 0 : _a.url;
|
|
10259
10510
|
}
|
|
10511
|
+
set url(url) {
|
|
10512
|
+
if (this.definition) {
|
|
10513
|
+
this.definition.url = url;
|
|
10514
|
+
}
|
|
10515
|
+
}
|
|
10260
10516
|
/**
|
|
10261
10517
|
* 以给定的参数搜索源和对应清晰度。`source` 和 `definition`
|
|
10262
10518
|
* 都是可选的,当未指定时,使用当前的 {@link SourceManager.source}
|
|
@@ -10326,14 +10582,6 @@ class SourceManager {
|
|
|
10326
10582
|
this.resetFallback();
|
|
10327
10583
|
return this;
|
|
10328
10584
|
}
|
|
10329
|
-
registerPrepare(prepare) {
|
|
10330
|
-
this._prepareList.push(prepare);
|
|
10331
|
-
}
|
|
10332
|
-
async prepare(url) {
|
|
10333
|
-
for (const prepare of this._prepareList) {
|
|
10334
|
-
await prepare(url);
|
|
10335
|
-
}
|
|
10336
|
-
}
|
|
10337
10585
|
resetFallback() {
|
|
10338
10586
|
this._fallbackCount = 0;
|
|
10339
10587
|
}
|
|
@@ -10775,12 +11023,13 @@ class MobilePlayerPanel {
|
|
|
10775
11023
|
}
|
|
10776
11024
|
}
|
|
10777
11025
|
var optionsIcon = "";
|
|
10778
|
-
|
|
10779
|
-
Middle
|
|
10780
|
-
Bottom
|
|
10781
|
-
Fullscreen
|
|
10782
|
-
Inner
|
|
10783
|
-
|
|
11026
|
+
var ListType = /* @__PURE__ */ ((ListType2) => {
|
|
11027
|
+
ListType2["Middle"] = "middle";
|
|
11028
|
+
ListType2["Bottom"] = "bottom";
|
|
11029
|
+
ListType2["Fullscreen"] = "fullscreen";
|
|
11030
|
+
ListType2["Inner"] = "inner";
|
|
11031
|
+
return ListType2;
|
|
11032
|
+
})(ListType || {});
|
|
10784
11033
|
var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
10785
11034
|
RenderType2["Icon"] = "Icon";
|
|
10786
11035
|
RenderType2["Text"] = "Text";
|
|
@@ -10788,20 +11037,26 @@ var RenderType = /* @__PURE__ */ ((RenderType2) => {
|
|
|
10788
11037
|
})(RenderType || {});
|
|
10789
11038
|
const isMobile$1 = sniffer$1.device === "mobile";
|
|
10790
11039
|
const MOBILE_LIST_TYPES = [
|
|
10791
|
-
|
|
10792
|
-
|
|
10793
|
-
|
|
11040
|
+
"bottom",
|
|
11041
|
+
"fullscreen",
|
|
11042
|
+
"inner"
|
|
11043
|
+
/* Inner */
|
|
11044
|
+
];
|
|
11045
|
+
const PC_LIST_TYPES = [
|
|
11046
|
+
"middle"
|
|
11047
|
+
/* Middle */
|
|
10794
11048
|
];
|
|
10795
|
-
const PC_LIST_TYPES = [ListType.Middle];
|
|
10796
11049
|
const MODAL_TYPES = [
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
11050
|
+
"bottom",
|
|
11051
|
+
"inner",
|
|
11052
|
+
"fullscreen"
|
|
11053
|
+
/* Fullscreen */
|
|
10800
11054
|
];
|
|
10801
11055
|
const CUSTOM_TYPES = [
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
11056
|
+
"bottom",
|
|
11057
|
+
"inner",
|
|
11058
|
+
"fullscreen"
|
|
11059
|
+
/* Fullscreen */
|
|
10805
11060
|
];
|
|
10806
11061
|
class OptionsIcon extends Plugin {
|
|
10807
11062
|
constructor(args) {
|
|
@@ -10839,7 +11094,7 @@ class OptionsIcon extends Plugin {
|
|
|
10839
11094
|
// 默认手机端在“右上角”,pc端在控制栏右侧
|
|
10840
11095
|
position: isMobile$1 ? POSITIONS$1.ROOT_TOP_RIGHT : POSITIONS$1.CONTROLS_RIGHT,
|
|
10841
11096
|
// 默认手机端列表展示底部,pc端在控制栏默认
|
|
10842
|
-
listType: isMobile$1 ?
|
|
11097
|
+
listType: isMobile$1 ? "bottom" : "middle",
|
|
10843
11098
|
index: 100,
|
|
10844
11099
|
list: [],
|
|
10845
11100
|
listStyle: {},
|
|
@@ -11021,10 +11276,10 @@ class OptionsIcon extends Plugin {
|
|
|
11021
11276
|
listType = this.player.config.listType;
|
|
11022
11277
|
}
|
|
11023
11278
|
if (!isMobile$1 && (!listType || !MOBILE_LIST_TYPES.includes(listType))) {
|
|
11024
|
-
listType =
|
|
11279
|
+
listType = "bottom";
|
|
11025
11280
|
}
|
|
11026
11281
|
if (!isMobile$1 && (!listType || !PC_LIST_TYPES.includes(listType))) {
|
|
11027
|
-
listType =
|
|
11282
|
+
listType = "middle";
|
|
11028
11283
|
}
|
|
11029
11284
|
return listType;
|
|
11030
11285
|
}
|
|
@@ -11917,9 +12172,7 @@ class DefinitionPlugin extends OptionsIcon {
|
|
|
11917
12172
|
toastPlugin.remove(this._toastId);
|
|
11918
12173
|
}
|
|
11919
12174
|
this._toastId = toastPlugin.toast(
|
|
11920
|
-
`${i18nManager.getText("DEFINITION_SWITCHING")} ${
|
|
11921
|
-
definition.text
|
|
11922
|
-
)) ?? definition.definition} ...`,
|
|
12175
|
+
`${i18nManager.getText("DEFINITION_SWITCHING")} ${definition.showText ?? definition.definition} ...`,
|
|
11923
12176
|
{
|
|
11924
12177
|
duration: 2e3,
|
|
11925
12178
|
closable: true
|
|
@@ -12683,21 +12936,21 @@ const EN$1 = {
|
|
|
12683
12936
|
// 自动播放插件
|
|
12684
12937
|
UNMUTE: "Click to unmute",
|
|
12685
12938
|
// 报错
|
|
12686
|
-
MANIFEST: "
|
|
12939
|
+
MANIFEST: "Video parsing error",
|
|
12687
12940
|
NETWORK: "Network error",
|
|
12688
12941
|
NETWORK_TIMEOUT: "Network timeout",
|
|
12689
|
-
NETWORK_FORBIDDEN: "
|
|
12690
|
-
NETWORK_NOTFOUND: "
|
|
12691
|
-
DEMUX: "
|
|
12692
|
-
REMUX: "
|
|
12693
|
-
MEDIA: "
|
|
12694
|
-
MEDIA_ERR_CODEC_NOT_SUPPORTED: "
|
|
12695
|
-
MEDIA_ERR_URL_EMPTY: "
|
|
12696
|
-
DRM: "
|
|
12697
|
-
OTHER: "
|
|
12698
|
-
RUNTIME: "
|
|
12699
|
-
MODULE_LOAD_ERROR: "
|
|
12700
|
-
UNKNOWN: "
|
|
12942
|
+
NETWORK_FORBIDDEN: "Authentication error",
|
|
12943
|
+
NETWORK_NOTFOUND: "Stream does not exist",
|
|
12944
|
+
DEMUX: "Video parsing error",
|
|
12945
|
+
REMUX: "Video parsing error",
|
|
12946
|
+
MEDIA: "An error occurred, Please try again",
|
|
12947
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: "Audio/video codec is not supported",
|
|
12948
|
+
MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
|
|
12949
|
+
DRM: "Permission verification failed",
|
|
12950
|
+
OTHER: "Unknown error",
|
|
12951
|
+
RUNTIME: "An error occurred, Please try again",
|
|
12952
|
+
MODULE_LOAD_ERROR: "CDN fetch error",
|
|
12953
|
+
UNKNOWN: "Unknown error"
|
|
12701
12954
|
};
|
|
12702
12955
|
const ZH_CN$1 = {
|
|
12703
12956
|
...ZH.TEXT,
|
|
@@ -12716,12 +12969,12 @@ const ZH_CN$1 = {
|
|
|
12716
12969
|
NETWORK_NOTFOUND: "播放地址不存在",
|
|
12717
12970
|
DEMUX: "视频解析错误",
|
|
12718
12971
|
REMUX: "视频解析错误",
|
|
12719
|
-
MEDIA: "
|
|
12720
|
-
MEDIA_ERR_CODEC_NOT_SUPPORTED: "
|
|
12972
|
+
MEDIA: "播放异常,请重试",
|
|
12973
|
+
MEDIA_ERR_CODEC_NOT_SUPPORTED: "不支持的音频/视频格式",
|
|
12721
12974
|
MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
|
|
12722
12975
|
DRM: "权限验证失败",
|
|
12723
12976
|
OTHER: "其他报错",
|
|
12724
|
-
RUNTIME: "
|
|
12977
|
+
RUNTIME: "播放异常,请重试",
|
|
12725
12978
|
MODULE_LOAD_ERROR: "插件模块加载异常",
|
|
12726
12979
|
UNKNOWN: "未知报错"
|
|
12727
12980
|
};
|
|
@@ -12778,21 +13031,6 @@ class VeI18n {
|
|
|
12778
13031
|
}
|
|
12779
13032
|
}
|
|
12780
13033
|
var veplayerBase = "";
|
|
12781
|
-
var Codec = /* @__PURE__ */ ((Codec2) => {
|
|
12782
|
-
Codec2["H265"] = "h265";
|
|
12783
|
-
Codec2["H264"] = "h264";
|
|
12784
|
-
return Codec2;
|
|
12785
|
-
})(Codec || {});
|
|
12786
|
-
var Degradation = /* @__PURE__ */ ((Degradation2) => {
|
|
12787
|
-
Degradation2["SoftFirst"] = "soft-first";
|
|
12788
|
-
Degradation2["H264First"] = "h264-first";
|
|
12789
|
-
return Degradation2;
|
|
12790
|
-
})(Degradation || {});
|
|
12791
|
-
var DecodeType = /* @__PURE__ */ ((DecodeType2) => {
|
|
12792
|
-
DecodeType2["Software"] = "software";
|
|
12793
|
-
DecodeType2["Hardware"] = "hardware";
|
|
12794
|
-
return DecodeType2;
|
|
12795
|
-
})(DecodeType || {});
|
|
12796
13034
|
const { POSITIONS: XGPosition } = Plugin;
|
|
12797
13035
|
const POSITIONS$1 = {
|
|
12798
13036
|
...XGPosition,
|
|
@@ -12802,7 +13040,7 @@ const DEFAULT_OPTIONS = {
|
|
|
12802
13040
|
id: "veplayer",
|
|
12803
13041
|
width: "100%",
|
|
12804
13042
|
height: "100%",
|
|
12805
|
-
decodeType:
|
|
13043
|
+
decodeType: DecodeType.Hardware,
|
|
12806
13044
|
fullscreen: {
|
|
12807
13045
|
useCssFullscreen: false
|
|
12808
13046
|
}
|
|
@@ -12830,6 +13068,9 @@ const transformOption = (options) => {
|
|
|
12830
13068
|
return xgOptions;
|
|
12831
13069
|
};
|
|
12832
13070
|
class VePlayerBase {
|
|
13071
|
+
/**
|
|
13072
|
+
* @hidden
|
|
13073
|
+
*/
|
|
12833
13074
|
constructor(options = {}) {
|
|
12834
13075
|
__publicField(this, "_player");
|
|
12835
13076
|
__publicField(this, "_sourceManager");
|
|
@@ -12877,85 +13118,172 @@ class VePlayerBase {
|
|
|
12877
13118
|
veplayer: this
|
|
12878
13119
|
});
|
|
12879
13120
|
this.emit(Events$1.PLAYER_CREATE_FINISH, this._player);
|
|
12880
|
-
this._sourceManager.registerPrepare((url) => this.prepare(url));
|
|
12881
13121
|
this._errorCallback = (err) => this._handleFallback(err);
|
|
12882
13122
|
this._player.on(ERROR, this._errorCallback);
|
|
12883
13123
|
}
|
|
13124
|
+
/**
|
|
13125
|
+
* @brief 获取视频的就绪状态,其状态枚举值、枚举名称和说明如下:
|
|
13126
|
+
* - `0`:HAVE_NOTHING,没有关于媒体资源的可用信息
|
|
13127
|
+
* - `1`:HAVE_METADATA,已检索到足够多的媒体资源来初始化元数据, 快进/快退不会引发异常
|
|
13128
|
+
* - `2`:HAVE_CURRENT_DATA,当前播放位置的数据可用,但不足以播放下一帧
|
|
13129
|
+
* - `3`:HAVE_FUTURE_DATA,当前播放位置以及未来至少一小段时间的数据是可用的(至少有两帧以上的数据)
|
|
13130
|
+
* - `4`:HAVE_ENOUGH_DATA,有足够的数据可用,并且下载速率足够,媒体可以不间断地播放到最后
|
|
13131
|
+
*/
|
|
12884
13132
|
get readyState() {
|
|
12885
13133
|
return this._player.readyState;
|
|
12886
13134
|
}
|
|
13135
|
+
/**
|
|
13136
|
+
* @brief 获取当前已缓冲的时间范围。
|
|
13137
|
+
*/
|
|
12887
13138
|
get buffered() {
|
|
12888
13139
|
return this._player.buffered;
|
|
12889
13140
|
}
|
|
13141
|
+
/**
|
|
13142
|
+
* @brief 获取已经播放的音频/视频的时间范围。
|
|
13143
|
+
*/
|
|
12890
13144
|
get played() {
|
|
12891
13145
|
return this._player.played;
|
|
12892
13146
|
}
|
|
13147
|
+
/**
|
|
13148
|
+
* @brief 设置/获取视频当前的播放时间, 单位为 s。
|
|
13149
|
+
*/
|
|
12893
13150
|
get cumulateTime() {
|
|
12894
13151
|
return this._player.cumulateTime;
|
|
12895
13152
|
}
|
|
13153
|
+
/**
|
|
13154
|
+
* @brief 获取是否处于焦点状态,处于焦点状态会显示控制栏。
|
|
13155
|
+
*/
|
|
12896
13156
|
get isFocused() {
|
|
12897
13157
|
return this._player.isActive;
|
|
12898
13158
|
}
|
|
13159
|
+
/**
|
|
13160
|
+
* @brief 获取播放器是否处于全屏状态。
|
|
13161
|
+
*/
|
|
12899
13162
|
get isFullscreen() {
|
|
12900
13163
|
return this._player.isFullscreen;
|
|
12901
13164
|
}
|
|
13165
|
+
/**
|
|
13166
|
+
* @brief 获取播放器是否处于网页全屏状态。
|
|
13167
|
+
*/
|
|
12902
13168
|
get isCssFullscreen() {
|
|
12903
13169
|
return this._player.isCssfullScreen;
|
|
12904
13170
|
}
|
|
13171
|
+
/**
|
|
13172
|
+
* @brief 获取视频的网络状态,其状态枚举值、枚举名称和说明如下:
|
|
13173
|
+
* - `0`:NETWORK_EMPTY,目前还没有数据,readyState 的值是 HAVE_NOTHING
|
|
13174
|
+
* - `1`:NETWORK_IDLE,HTMLMediaElement 处于活动状态并已选择资源,但未使用网络
|
|
13175
|
+
* - `2`:NETWORK_LOADING,浏览器正在下载 HTMLMediaElement 数据
|
|
13176
|
+
* - `3`:NETWORK_NO_SOURCE,未找到 HTMLMediaElement src。
|
|
13177
|
+
*/
|
|
12905
13178
|
get networkState() {
|
|
12906
13179
|
return this._player.networkState;
|
|
12907
13180
|
}
|
|
13181
|
+
/**
|
|
13182
|
+
* @brief 获取当前视频是否处于暂停状态。
|
|
13183
|
+
*/
|
|
12908
13184
|
get paused() {
|
|
12909
13185
|
return this._player.paused;
|
|
12910
13186
|
}
|
|
13187
|
+
/**
|
|
13188
|
+
* @brief 获取当前视频是否播放结束。
|
|
13189
|
+
*/
|
|
12911
13190
|
get ended() {
|
|
12912
13191
|
return this._player.ended;
|
|
12913
13192
|
}
|
|
13193
|
+
/**
|
|
13194
|
+
* @brief 获取播放器当前所处的状态,其状态枚举值、枚举名称和说明如下:
|
|
13195
|
+
* - `0`:ERROR,播放出现错误
|
|
13196
|
+
* - `1`:INITIAL,初始化
|
|
13197
|
+
* - `2`:READY,配置/事件/插件等均已经初始化/绑定/实例化完成
|
|
13198
|
+
* - `3`:ATTACHING,进入媒体对象挂载阶段
|
|
13199
|
+
* - `4`:ATTACHED,媒体对象已经挂载到了 DOM 中
|
|
13200
|
+
* - `5`:NOTALLOW,播放被阻止
|
|
13201
|
+
* - `6`:RUNNING,已经成功起播进入播放流程
|
|
13202
|
+
* - `7`:ENDED,播放结束
|
|
13203
|
+
* - `8`:DESTROYED,播放器实例处于已被销毁
|
|
13204
|
+
*/
|
|
12914
13205
|
get state() {
|
|
12915
13206
|
return this._player.state;
|
|
12916
13207
|
}
|
|
13208
|
+
/**
|
|
13209
|
+
* 获取当前播放视频的拉流地址。
|
|
13210
|
+
*/
|
|
12917
13211
|
get url() {
|
|
12918
13212
|
return this._player.config.url;
|
|
12919
13213
|
}
|
|
13214
|
+
/**
|
|
13215
|
+
* @brief 获取当播放视频的线路名称唯一标识(name)。
|
|
13216
|
+
*/
|
|
12920
13217
|
get source() {
|
|
12921
13218
|
var _a;
|
|
12922
13219
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
12923
13220
|
}
|
|
13221
|
+
/**
|
|
13222
|
+
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13223
|
+
*/
|
|
12924
13224
|
get definition() {
|
|
12925
13225
|
var _a;
|
|
12926
13226
|
return (_a = this._sourceManager.definition) == null ? void 0 : _a.definition;
|
|
12927
13227
|
}
|
|
13228
|
+
/**
|
|
13229
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13230
|
+
*/
|
|
12928
13231
|
get crossOrigin() {
|
|
12929
13232
|
return this._player.crossOrigin;
|
|
12930
13233
|
}
|
|
13234
|
+
/**
|
|
13235
|
+
* @brief 获取和设置播放器的跨域配置信息,更多信息参考 [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/crossorigin) 属性介绍。
|
|
13236
|
+
*/
|
|
12931
13237
|
set crossOrigin(crossOrigin) {
|
|
12932
13238
|
this._player.crossOrigin = crossOrigin;
|
|
12933
13239
|
}
|
|
13240
|
+
/**
|
|
13241
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13242
|
+
*/
|
|
12934
13243
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12935
13244
|
get volume() {
|
|
12936
13245
|
return this._player.volume;
|
|
12937
13246
|
}
|
|
13247
|
+
/**
|
|
13248
|
+
* @brief 获取和设置视频的音量,取值范围为 [0,1]。
|
|
13249
|
+
*/
|
|
12938
13250
|
set volume(volume) {
|
|
12939
13251
|
this._player.volume = volume;
|
|
12940
13252
|
}
|
|
13253
|
+
/**
|
|
13254
|
+
* @brief 获取和设置视频静音状态。
|
|
13255
|
+
* - `true`:静音
|
|
13256
|
+
* - `false`:非静音
|
|
13257
|
+
*/
|
|
12941
13258
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12942
13259
|
get muted() {
|
|
12943
13260
|
return this._player.muted;
|
|
12944
13261
|
}
|
|
13262
|
+
/**
|
|
13263
|
+
* @brief 获取和设置视频静音状态。
|
|
13264
|
+
* - `true`:静音
|
|
13265
|
+
* - `false`:非静音
|
|
13266
|
+
*/
|
|
12945
13267
|
set muted(isMuted) {
|
|
12946
13268
|
this._player.muted = isMuted;
|
|
12947
13269
|
}
|
|
13270
|
+
/**
|
|
13271
|
+
* @brief 获取和设置当前语言。
|
|
13272
|
+
*/
|
|
12948
13273
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
12949
13274
|
get lang() {
|
|
12950
13275
|
return this._i18nManager.getLang();
|
|
12951
13276
|
}
|
|
13277
|
+
/**
|
|
13278
|
+
* @brief 获取和设置当前语言。
|
|
13279
|
+
*/
|
|
12952
13280
|
set lang(lang) {
|
|
12953
13281
|
var _a, _b;
|
|
12954
13282
|
if (this._player.lang === lang) {
|
|
12955
13283
|
return;
|
|
12956
13284
|
}
|
|
12957
13285
|
if (!VeI18n.isLangValid(lang)) {
|
|
12958
|
-
const langKeys = VeI18n.langKeys
|
|
13286
|
+
const langKeys = VeI18n.langKeys.join(",");
|
|
12959
13287
|
const message = {
|
|
12960
13288
|
en: `Sorry, we couldn't set the language to ${lang} because it's not currently supported. The list of supported languages includes ${langKeys}.`,
|
|
12961
13289
|
"zh-cn": `不支持当前设置的语言${lang}, 支持的语言有${langKeys}, 请重新设置`
|
|
@@ -12970,8 +13298,11 @@ class VePlayerBase {
|
|
|
12970
13298
|
get _src() {
|
|
12971
13299
|
return this._player.currentSrc;
|
|
12972
13300
|
}
|
|
13301
|
+
/**
|
|
13302
|
+
* @hidden
|
|
13303
|
+
*/
|
|
12973
13304
|
static async create(options = {}, Constructor) {
|
|
12974
|
-
var _a;
|
|
13305
|
+
var _a, _b, _c;
|
|
12975
13306
|
const sourceManager = new SourceManager({
|
|
12976
13307
|
sources: Source.normalize({
|
|
12977
13308
|
url: options.url,
|
|
@@ -12983,18 +13314,28 @@ class VePlayerBase {
|
|
|
12983
13314
|
defaultDefinition: options.defaultDefinition,
|
|
12984
13315
|
maxFallbackRound: options.maxFallbackRound
|
|
12985
13316
|
});
|
|
13317
|
+
const prepareResult = await ((_a = options == null ? void 0 : options.preparePlugins) == null ? void 0 : _a.call(
|
|
13318
|
+
options,
|
|
13319
|
+
sourceManager.url ?? ""
|
|
13320
|
+
));
|
|
13321
|
+
if ((_b = prepareResult == null ? void 0 : prepareResult.options) == null ? void 0 : _b.url) {
|
|
13322
|
+
sourceManager.url = (_c = prepareResult == null ? void 0 : prepareResult.options) == null ? void 0 : _c.url;
|
|
13323
|
+
}
|
|
12986
13324
|
options.url = sourceManager.url;
|
|
12987
|
-
const prepareResult = await ((_a = options == null ? void 0 : options.preparePlugins) == null ? void 0 : _a.call(options, options.url ?? ""));
|
|
12988
13325
|
return new (Constructor ?? VePlayerBase)({
|
|
12989
13326
|
...options,
|
|
12990
13327
|
prepareResult,
|
|
12991
13328
|
sourceManager
|
|
12992
13329
|
});
|
|
12993
13330
|
}
|
|
13331
|
+
/**
|
|
13332
|
+
* @brief 调用此方法切换拉流地址、线路、清晰度。
|
|
13333
|
+
* @param target 目标地址,可以是播放地址,也可以是线路和清晰度
|
|
13334
|
+
* @param options 更多配置信息
|
|
13335
|
+
*/
|
|
12994
13336
|
async switch(target, options) {
|
|
12995
13337
|
var _a, _b;
|
|
12996
13338
|
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) {
|
|
12997
|
-
this._sourceManager.updateSources(target);
|
|
12998
13339
|
await this._switchUrl(target);
|
|
12999
13340
|
return this._sourceManager.definition;
|
|
13000
13341
|
}
|
|
@@ -13007,12 +13348,22 @@ class VePlayerBase {
|
|
|
13007
13348
|
await this._switch(targetDefinition);
|
|
13008
13349
|
return targetDefinition;
|
|
13009
13350
|
}
|
|
13351
|
+
/**
|
|
13352
|
+
* @brief 调用此方法更新拉流地址列表。
|
|
13353
|
+
* @param playlist 要更新的播放列表。
|
|
13354
|
+
* @param target 更新后默认播放的资源。
|
|
13355
|
+
*/
|
|
13010
13356
|
updatePlaylist(playlist, target) {
|
|
13011
13357
|
const sourceManager = this._sourceManager.updateSources(playlist, target);
|
|
13012
13358
|
return this._switch(sourceManager.definition);
|
|
13013
13359
|
}
|
|
13014
13360
|
// TODO: 等西瓜播放器完善错误码后增加函数重载以提供更好的类型
|
|
13015
|
-
|
|
13361
|
+
/**
|
|
13362
|
+
* @brief 调用此方法监听指定事件,事件处理函数只执行一次。
|
|
13363
|
+
* @param event 表示事件的名称。
|
|
13364
|
+
* @param callback 表示事件的名称。
|
|
13365
|
+
*/
|
|
13366
|
+
once(event, callback) {
|
|
13016
13367
|
var _a;
|
|
13017
13368
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
13018
13369
|
if (xgCallback) {
|
|
@@ -13020,27 +13371,45 @@ class VePlayerBase {
|
|
|
13020
13371
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
13021
13372
|
}
|
|
13022
13373
|
this._events[event].set(callback, xgCallback);
|
|
13023
|
-
this._player.once(xgEventName, xgCallback
|
|
13374
|
+
this._player.once(xgEventName, xgCallback);
|
|
13024
13375
|
}
|
|
13025
13376
|
}
|
|
13026
|
-
|
|
13377
|
+
/**
|
|
13378
|
+
* @brief 调用此方法解绑或移除指定事件的事件监听。
|
|
13379
|
+
* @param event 表示事件的名称。
|
|
13380
|
+
* @param callback 表示事件的名称。
|
|
13381
|
+
*/
|
|
13382
|
+
off(event, callback) {
|
|
13027
13383
|
var _a;
|
|
13028
13384
|
const xgCallback = (_a = this._events[event]) == null ? void 0 : _a.get(callback);
|
|
13029
13385
|
const { xgEventName } = this._transformEvent(event);
|
|
13030
13386
|
if (xgCallback) {
|
|
13031
|
-
this._player.off(xgEventName, xgCallback
|
|
13387
|
+
this._player.off(xgEventName, xgCallback);
|
|
13032
13388
|
this._events[event].delete(callback);
|
|
13033
13389
|
}
|
|
13034
13390
|
}
|
|
13035
|
-
|
|
13391
|
+
/**
|
|
13392
|
+
* @brief 调用此方法触发指定事件。
|
|
13393
|
+
* @param event 表示事件的名称。
|
|
13394
|
+
* @param data 事件信息。
|
|
13395
|
+
*/
|
|
13396
|
+
emit(event, data) {
|
|
13036
13397
|
const { xgEventName } = this._transformEvent(event);
|
|
13037
|
-
this._player.emit(xgEventName, data
|
|
13398
|
+
this._player.emit(xgEventName, data);
|
|
13038
13399
|
}
|
|
13400
|
+
/**
|
|
13401
|
+
* @brief 调用此方法解绑或移除指定事件的所有事件监听。
|
|
13402
|
+
*/
|
|
13039
13403
|
offAll() {
|
|
13040
13404
|
this._events = {};
|
|
13041
13405
|
this._player.offAll();
|
|
13042
13406
|
}
|
|
13043
|
-
|
|
13407
|
+
/**
|
|
13408
|
+
* @brief 调用此方法监听指定事件。
|
|
13409
|
+
* @param event 事件。
|
|
13410
|
+
* @param callback 事件回调。
|
|
13411
|
+
*/
|
|
13412
|
+
on(event, callback) {
|
|
13044
13413
|
var _a;
|
|
13045
13414
|
const { xgCallback, xgEventName } = this._transformEvent(event, callback);
|
|
13046
13415
|
if (xgCallback) {
|
|
@@ -13048,56 +13417,105 @@ class VePlayerBase {
|
|
|
13048
13417
|
this._events[event] = /* @__PURE__ */ new Map();
|
|
13049
13418
|
}
|
|
13050
13419
|
this._events[event].set(callback, xgCallback);
|
|
13051
|
-
this._player.on(xgEventName, xgCallback
|
|
13420
|
+
this._player.on(xgEventName, xgCallback);
|
|
13052
13421
|
}
|
|
13053
13422
|
}
|
|
13423
|
+
/**
|
|
13424
|
+
* @brief 调用此方法开始播放 。
|
|
13425
|
+
*/
|
|
13054
13426
|
play() {
|
|
13055
13427
|
/* istanbul ignore next -- @preserve */
|
|
13056
13428
|
return this._player.play();
|
|
13057
13429
|
}
|
|
13430
|
+
/**
|
|
13431
|
+
* @brief 调用此方法暂停播放。
|
|
13432
|
+
*/
|
|
13058
13433
|
pause() {
|
|
13059
13434
|
/* istanbul ignore next -- @preserve */
|
|
13060
13435
|
return this._player.pause();
|
|
13061
13436
|
}
|
|
13437
|
+
/**
|
|
13438
|
+
* @brief 调用此方法打开画中画。
|
|
13439
|
+
*/
|
|
13062
13440
|
requestPIP() {
|
|
13063
13441
|
var _a;
|
|
13064
13442
|
/* istanbul ignore next -- @preserve */
|
|
13065
13443
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.requestPIP();
|
|
13066
13444
|
}
|
|
13445
|
+
/**
|
|
13446
|
+
* @brief 调用此方法关闭画中画。
|
|
13447
|
+
*/
|
|
13067
13448
|
exitPIP() {
|
|
13068
13449
|
var _a;
|
|
13069
13450
|
/* istanbul ignore next -- @preserve */
|
|
13070
13451
|
(_a = this._player.plugins.pip) == null ? void 0 : _a.exitPIP();
|
|
13071
13452
|
}
|
|
13453
|
+
/**
|
|
13454
|
+
* @brief 调用此方法重新拉流。
|
|
13455
|
+
*/
|
|
13072
13456
|
retry() {
|
|
13073
|
-
this._player.emit(Events$1.RETRY);
|
|
13074
13457
|
return this._player.retry();
|
|
13075
13458
|
}
|
|
13459
|
+
/**
|
|
13460
|
+
* @brief 播放器获取焦点,调用该方法 `veplayer.isFocused` 将会变为 `true`,并触发 `PLAYER_FOCUS` 事件。
|
|
13461
|
+
* @param data 播放器获取焦点配置信息。
|
|
13462
|
+
*/
|
|
13076
13463
|
focus(data) {
|
|
13077
13464
|
return this._player.focus(data);
|
|
13078
13465
|
}
|
|
13466
|
+
/**
|
|
13467
|
+
* @brief 播放器失去焦点,调用该方法 `veplayer.isFocused` 将会变为 `false`,并触发 `PLAYER_BLUR` 事件。
|
|
13468
|
+
* @param data 播放器失去焦点配置信息。
|
|
13469
|
+
*/
|
|
13079
13470
|
blur(data) {
|
|
13080
13471
|
return this._player.blur(data);
|
|
13081
13472
|
}
|
|
13082
|
-
|
|
13473
|
+
/**
|
|
13474
|
+
* @brief 调用此方法进入系统全屏状态。如果该方法调用的时候处于网页全屏状态会自动退出网页全屏,下发事件 `Events.FULLSCREEN_CHANGE`。
|
|
13475
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13476
|
+
*/
|
|
13477
|
+
requestFullscreen(el) {
|
|
13083
13478
|
return this._player.getFullscreen(el);
|
|
13084
13479
|
}
|
|
13480
|
+
/**
|
|
13481
|
+
* @brief 调用此方法退出系统全屏状态,调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.FULLSCREEN_CHANGE` 事件。
|
|
13482
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13483
|
+
*/
|
|
13085
13484
|
exitFullscreen(el) {
|
|
13086
13485
|
return this._player.exitFullscreen(el);
|
|
13087
13486
|
}
|
|
13088
|
-
|
|
13487
|
+
/**
|
|
13488
|
+
* @brief 调用此方法进入网页样式全屏状态,播放器进入网页全屏,利用 CSS 模拟实现全屏效果。如果该接口调用的时候处于全屏状态,会自动退出全屏,下发事件 `Events.CSS_FULLSCREEN_CHANGE`。
|
|
13489
|
+
* @param el 全屏作用的 DOM 节点。
|
|
13490
|
+
*/
|
|
13491
|
+
requestCssFullscreen(el) {
|
|
13089
13492
|
return this._player.getCssFullscreen(el);
|
|
13090
13493
|
}
|
|
13494
|
+
/**
|
|
13495
|
+
* @brief 调用此方法退出网页样式全屏状态。 调用该方法 `veplayer.isFullscreen` 将会变为 `false`,并触发 `Events.CSS_FULLSCREEN_CHANGE` 事件。
|
|
13496
|
+
*/
|
|
13091
13497
|
exitCssFullscreen() {
|
|
13092
13498
|
return this._player.exitCssFullscreen();
|
|
13093
13499
|
}
|
|
13500
|
+
/**
|
|
13501
|
+
* @brief 调用此方法在当前播放器上注册指定插件。
|
|
13502
|
+
* @param plugin 插件构造函数。
|
|
13503
|
+
* @param config 插件的配置列表。
|
|
13504
|
+
*/
|
|
13094
13505
|
registerPlugin(plugin, config) {
|
|
13095
13506
|
return this._player.registerPlugin(plugin, config);
|
|
13096
13507
|
}
|
|
13097
|
-
|
|
13098
|
-
|
|
13508
|
+
/**
|
|
13509
|
+
* @brief 调用此方法在当前播放器上销毁/注销指定插件。
|
|
13510
|
+
* @param plugin 插件实例或者插件名称。
|
|
13511
|
+
*/
|
|
13512
|
+
unRegisterPlugin(plugin) {
|
|
13513
|
+
return this._player.unRegisterPlugin(plugin);
|
|
13099
13514
|
}
|
|
13100
|
-
|
|
13515
|
+
/**
|
|
13516
|
+
* @brief 调用此接口显示指定插件图标。
|
|
13517
|
+
* @param pluginNames 插件名称
|
|
13518
|
+
*/
|
|
13101
13519
|
showIcon(pluginNames) {
|
|
13102
13520
|
const morePlugin = this._player.getPlugin("more");
|
|
13103
13521
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13111,7 +13529,10 @@ class VePlayerBase {
|
|
|
13111
13529
|
}
|
|
13112
13530
|
});
|
|
13113
13531
|
}
|
|
13114
|
-
|
|
13532
|
+
/**
|
|
13533
|
+
* @brief 调用此接口隐藏指定插件图标。
|
|
13534
|
+
* @param pluginNames 插件名称
|
|
13535
|
+
*/
|
|
13115
13536
|
hideIcon(pluginNames) {
|
|
13116
13537
|
const morePlugin = this._player.getPlugin("more");
|
|
13117
13538
|
pluginNames.forEach((pluginName) => {
|
|
@@ -13125,10 +13546,16 @@ class VePlayerBase {
|
|
|
13125
13546
|
}
|
|
13126
13547
|
});
|
|
13127
13548
|
}
|
|
13549
|
+
/**
|
|
13550
|
+
* @brief 调用此方法销毁播放器实例。
|
|
13551
|
+
*/
|
|
13128
13552
|
destroy() {
|
|
13129
13553
|
this._player.off(ERROR, this._errorCallback);
|
|
13130
13554
|
this._player.destroy();
|
|
13131
13555
|
}
|
|
13556
|
+
/**
|
|
13557
|
+
* @hidden
|
|
13558
|
+
*/
|
|
13132
13559
|
async prepare(url) {
|
|
13133
13560
|
var _a, _b;
|
|
13134
13561
|
const result = await ((_a = this._preparePlugins) == null ? void 0 : _a.call(this, url));
|
|
@@ -13144,9 +13571,12 @@ class VePlayerBase {
|
|
|
13144
13571
|
if (result == null ? void 0 : result.options) {
|
|
13145
13572
|
this._player.setConfig(result.options);
|
|
13146
13573
|
}
|
|
13147
|
-
return
|
|
13148
|
-
|
|
13149
|
-
|
|
13574
|
+
return {
|
|
13575
|
+
plugins: addedPlugins.map((plugin) => {
|
|
13576
|
+
return this._player.registerPlugin(plugin);
|
|
13577
|
+
}),
|
|
13578
|
+
options: result == null ? void 0 : result.options
|
|
13579
|
+
};
|
|
13150
13580
|
}
|
|
13151
13581
|
async _handleFallback(err) {
|
|
13152
13582
|
this._player.addClass(STATE_CLASS.ENTER);
|
|
@@ -13181,7 +13611,10 @@ class VePlayerBase {
|
|
|
13181
13611
|
async _switch(targetDefinition) {
|
|
13182
13612
|
var _a, _b, _c, _d, _e, _f;
|
|
13183
13613
|
const preDefinition = clonedeep(this._sourceManager.definition);
|
|
13184
|
-
const newPlugins = await this.prepare(targetDefinition.url);
|
|
13614
|
+
const { plugins: newPlugins, options } = await this.prepare(targetDefinition.url) || {};
|
|
13615
|
+
if (options == null ? void 0 : options.url) {
|
|
13616
|
+
targetDefinition.url = options == null ? void 0 : options.url;
|
|
13617
|
+
}
|
|
13185
13618
|
this._sourceManager.switch(targetDefinition);
|
|
13186
13619
|
(_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
|
|
13187
13620
|
(_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
|
|
@@ -13197,11 +13630,13 @@ class VePlayerBase {
|
|
|
13197
13630
|
}
|
|
13198
13631
|
}
|
|
13199
13632
|
async _switchUrl(url) {
|
|
13200
|
-
const newPlugins = await this.prepare(url);
|
|
13633
|
+
const { plugins: newPlugins, options } = await this.prepare(url) || {};
|
|
13634
|
+
const newUrl = (options == null ? void 0 : options.url) ?? url;
|
|
13635
|
+
this._sourceManager.updateSources(newUrl);
|
|
13201
13636
|
if (newPlugins == null ? void 0 : newPlugins.length) {
|
|
13202
|
-
this._callBeforePlayerInitForUrl(newPlugins,
|
|
13637
|
+
this._callBeforePlayerInitForUrl(newPlugins, newUrl);
|
|
13203
13638
|
} else {
|
|
13204
|
-
const res = this._player.switchURL(
|
|
13639
|
+
const res = this._player.switchURL(newUrl, false);
|
|
13205
13640
|
const curTime = this._player.currentTime;
|
|
13206
13641
|
if (res && res.then) {
|
|
13207
13642
|
return res;
|
|
@@ -17755,7 +18190,7 @@ const getFlvStrategy = async (options) => {
|
|
|
17755
18190
|
let mseStrategy;
|
|
17756
18191
|
let softStrategy;
|
|
17757
18192
|
const codec = await getCodec(options);
|
|
17758
|
-
const isSoftDecode$1 =
|
|
18193
|
+
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
17759
18194
|
if (isSoftDecode$1) {
|
|
17760
18195
|
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
17761
18196
|
mseStrategy = createFlvMseStrategy(options);
|
|
@@ -17782,7 +18217,7 @@ const getHlsStrategy = async (options) => {
|
|
|
17782
18217
|
let mseStrategy;
|
|
17783
18218
|
let softStrategy;
|
|
17784
18219
|
const codec = await getCodec(options);
|
|
17785
|
-
const isSoftDecode$1 =
|
|
18220
|
+
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
17786
18221
|
if (isSoftDecode$1) {
|
|
17787
18222
|
softStrategy = codec === Codec.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
|
|
17788
18223
|
mseStrategy = createHlsMseStrategy(options);
|
|
@@ -17888,10 +18323,13 @@ async function detectCodec(url) {
|
|
|
17888
18323
|
return "unknown";
|
|
17889
18324
|
}
|
|
17890
18325
|
}
|
|
17891
|
-
async function isSoftDecode(options) {
|
|
18326
|
+
async function isSoftDecode(options, currentCodec) {
|
|
17892
18327
|
if (options.decodeType === DecodeType.Software) {
|
|
17893
18328
|
return true;
|
|
17894
18329
|
}
|
|
18330
|
+
if (currentCodec === "unknown") {
|
|
18331
|
+
return false;
|
|
18332
|
+
}
|
|
17895
18333
|
const codec = await getCodec(options);
|
|
17896
18334
|
if (codec === Codec.H265) {
|
|
17897
18335
|
if (sniffer$1.isHevcSupported()) {
|
|
@@ -17911,7 +18349,7 @@ function combineOptions(strategyList) {
|
|
|
17911
18349
|
}
|
|
17912
18350
|
const { VeError: VeError2 } = error$1;
|
|
17913
18351
|
var LiveErrorCode = /* @__PURE__ */ ((LiveErrorCode2) => {
|
|
17914
|
-
LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] =
|
|
18352
|
+
LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 210] = "INVALID_PARAMETER";
|
|
17915
18353
|
return LiveErrorCode2;
|
|
17916
18354
|
})(LiveErrorCode || {});
|
|
17917
18355
|
const ErrorCode = {
|
|
@@ -17921,7 +18359,7 @@ const ErrorCode = {
|
|
|
17921
18359
|
const ERRORS = {
|
|
17922
18360
|
...ERROR_INFO,
|
|
17923
18361
|
[
|
|
17924
|
-
|
|
18362
|
+
210
|
|
17925
18363
|
/* INVALID_PARAMETER */
|
|
17926
18364
|
]: {
|
|
17927
18365
|
messageTextKey: "INVALID_PARAMETER",
|
|
@@ -17931,15 +18369,34 @@ const ERRORS = {
|
|
|
17931
18369
|
function create(errorCode, i18n) {
|
|
17932
18370
|
return new VeError2(ERRORS[errorCode], i18n);
|
|
17933
18371
|
}
|
|
18372
|
+
async function isRTMSupported() {
|
|
18373
|
+
const Rtm = await load(DynamicModule.PluginRtm);
|
|
18374
|
+
return Rtm.isSupported();
|
|
18375
|
+
}
|
|
18376
|
+
async function isRTMSupportCodec(codec = RTMCodec.H264) {
|
|
18377
|
+
const Rtm = await load(DynamicModule.PluginRtm);
|
|
18378
|
+
if (codec === RTMCodec.H264)
|
|
18379
|
+
return Rtm.isSupportedH264();
|
|
18380
|
+
return false;
|
|
18381
|
+
}
|
|
17934
18382
|
const rtmStrategy = {
|
|
17935
18383
|
options: {},
|
|
17936
18384
|
module: DynamicModule.PluginRtm
|
|
17937
18385
|
};
|
|
17938
|
-
const
|
|
18386
|
+
const generateFallbackUrl = (url) => {
|
|
18387
|
+
if (sniffer$1.device === "pc") {
|
|
18388
|
+
return url.replace(".sdp", ".flv");
|
|
18389
|
+
} else {
|
|
18390
|
+
return url.replace(".sdp", ".m3u8");
|
|
18391
|
+
}
|
|
18392
|
+
};
|
|
18393
|
+
const getRtmStrategy = async (options, player) => {
|
|
17939
18394
|
var _a;
|
|
17940
18395
|
let backupStrategy;
|
|
17941
|
-
const {
|
|
17942
|
-
const
|
|
18396
|
+
const { url } = options;
|
|
18397
|
+
const { fallbackUrl, enableFallback = true, ...ret } = options.rtm || {};
|
|
18398
|
+
const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
|
|
18399
|
+
const backupType = actualFallbackUrl && util.getStreamType(actualFallbackUrl);
|
|
17943
18400
|
if (backupType === "flv" && util.isMseSupported(Codec.H264)) {
|
|
17944
18401
|
backupStrategy = createFlvMseStrategy(options);
|
|
17945
18402
|
} else if (backupType === "hls" && (sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util.isMseSupported(Codec.H264)) {
|
|
@@ -17949,39 +18406,55 @@ const getRtmStrategy = async (options) => {
|
|
|
17949
18406
|
load(rtmStrategy.module).catch(() => void 0),
|
|
17950
18407
|
backupStrategy && load(backupStrategy.module).catch(() => void 0)
|
|
17951
18408
|
]);
|
|
18409
|
+
const [RTMSupported, RTMSupportCodec] = await Promise.all([
|
|
18410
|
+
isRTMSupported(),
|
|
18411
|
+
isRTMSupportCodec()
|
|
18412
|
+
]);
|
|
18413
|
+
if (!RTMSupported || !RTMSupportCodec) {
|
|
18414
|
+
if (player) {
|
|
18415
|
+
player.emit("degrade", {
|
|
18416
|
+
url: actualFallbackUrl,
|
|
18417
|
+
originRtmUrl: url,
|
|
18418
|
+
code: "NOT_SUPPORT",
|
|
18419
|
+
message: "not support rtm or h264",
|
|
18420
|
+
isRTMSupported: RTMSupported,
|
|
18421
|
+
isRTMSupportCodec: RTMSupportCodec
|
|
18422
|
+
});
|
|
18423
|
+
}
|
|
18424
|
+
return {
|
|
18425
|
+
options: {
|
|
18426
|
+
...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
|
|
18427
|
+
url: actualFallbackUrl,
|
|
18428
|
+
_RTMdegrade: {
|
|
18429
|
+
_originRtmUrl: url,
|
|
18430
|
+
_isRTMSupported: RTMSupported,
|
|
18431
|
+
_isRTMSupportCodec: RTMSupportCodec
|
|
18432
|
+
}
|
|
18433
|
+
},
|
|
18434
|
+
plugins: backupCdn ? [backupCdn] : []
|
|
18435
|
+
};
|
|
18436
|
+
}
|
|
17952
18437
|
return {
|
|
17953
18438
|
options: {
|
|
17954
18439
|
...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
|
|
18440
|
+
_RTMdegrade: void 0,
|
|
17955
18441
|
rts: {
|
|
17956
18442
|
retryCount: 0,
|
|
17957
18443
|
...ret,
|
|
17958
|
-
backupURL:
|
|
18444
|
+
backupURL: actualFallbackUrl,
|
|
17959
18445
|
backupConstruct: backupCdn
|
|
17960
18446
|
}
|
|
17961
18447
|
},
|
|
17962
18448
|
plugins: rtmCdn ? [rtmCdn] : []
|
|
17963
18449
|
};
|
|
17964
18450
|
};
|
|
17965
|
-
|
|
17966
|
-
RTMCodec2["H264"] = "h264";
|
|
17967
|
-
return RTMCodec2;
|
|
17968
|
-
})(RTMCodec || {});
|
|
17969
|
-
const isRTMSupported = async () => {
|
|
17970
|
-
const Rtm = await load(DynamicModule.PluginRtm);
|
|
17971
|
-
return Rtm.isSupported();
|
|
17972
|
-
};
|
|
17973
|
-
const isRTMSupportCodec = async (codec = "h264", options) => {
|
|
17974
|
-
const Rtm = await load(DynamicModule.PluginRtm);
|
|
17975
|
-
if (codec === "h264")
|
|
17976
|
-
return Rtm.isSupportedH264(options == null ? void 0 : options.targetProfileLevel);
|
|
17977
|
-
};
|
|
17978
|
-
const getTypeStrategy = async (options) => {
|
|
18451
|
+
const getTypeStrategy = async (options, player) => {
|
|
17979
18452
|
const type = options.url ? util.getStreamType(options.url) : "";
|
|
17980
18453
|
if (!type || type === "unknown") {
|
|
17981
18454
|
return { options: {}, plugins: [] };
|
|
17982
18455
|
}
|
|
17983
18456
|
if (type === "rtm") {
|
|
17984
|
-
return await getRtmStrategy(options);
|
|
18457
|
+
return await getRtmStrategy(options, player);
|
|
17985
18458
|
}
|
|
17986
18459
|
if (type === "flv") {
|
|
17987
18460
|
return await getFlvStrategy(options);
|
|
@@ -18429,9 +18902,9 @@ function getPlayFormat(url) {
|
|
|
18429
18902
|
function isCodecSupport(codec) {
|
|
18430
18903
|
return typeof MediaSource !== "undefined" ? +MediaSource.isTypeSupported("video/mp4; codecs=" + codec) : 0;
|
|
18431
18904
|
}
|
|
18432
|
-
function getUrlQuery(url, key) {
|
|
18905
|
+
function getUrlQuery(url, key, key2) {
|
|
18433
18906
|
var x2 = new URLSearchParams(url.split("?")[1]);
|
|
18434
|
-
return x2.get(key);
|
|
18907
|
+
return x2.get(key) || x2.get(key2);
|
|
18435
18908
|
}
|
|
18436
18909
|
function getDeviceInfo() {
|
|
18437
18910
|
var res = {
|
|
@@ -18458,19 +18931,11 @@ function getPlayerCore(player) {
|
|
|
18458
18931
|
return player.plugins.hls;
|
|
18459
18932
|
} else if (player.plugins.rts) {
|
|
18460
18933
|
return player.plugins.rts;
|
|
18461
|
-
} else if (player.plugins.
|
|
18462
|
-
return player.plugins.
|
|
18463
|
-
}
|
|
18464
|
-
|
|
18465
|
-
|
|
18466
|
-
return player.plugins.hlsvod;
|
|
18467
|
-
} else if (player.plugins.hlslivemobile) {
|
|
18468
|
-
return player.plugins.hlslivemobile;
|
|
18469
|
-
} else if (player.plugins.flvlivemobile) {
|
|
18470
|
-
return player.plugins.flvlivemobile;
|
|
18471
|
-
}
|
|
18472
|
-
}
|
|
18473
|
-
return player.newHls || player.newFlv || player.__core__ || player.flv;
|
|
18934
|
+
} else if (player.plugins.rtm) {
|
|
18935
|
+
return player.plugins.rtm;
|
|
18936
|
+
}
|
|
18937
|
+
}
|
|
18938
|
+
return null;
|
|
18474
18939
|
}
|
|
18475
18940
|
function getDefaultOptions(options) {
|
|
18476
18941
|
return {
|
|
@@ -18699,7 +19164,7 @@ function getCommonLog(options) {
|
|
|
18699
19164
|
live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
|
|
18700
19165
|
player_sdk_version: player.version,
|
|
18701
19166
|
// eslint-disable-next-line no-undef
|
|
18702
|
-
logger_version: "1.1.0-alpha.
|
|
19167
|
+
logger_version: "1.1.0-alpha.7",
|
|
18703
19168
|
// 由rollup 在编译时注入
|
|
18704
19169
|
report_version: "5",
|
|
18705
19170
|
product_line: options.product_line,
|
|
@@ -18823,9 +19288,13 @@ var Manage = /* @__PURE__ */ function() {
|
|
|
18823
19288
|
if (this._player.video) {
|
|
18824
19289
|
log.play_current_time = this._player.currentTime;
|
|
18825
19290
|
}
|
|
18826
|
-
|
|
18827
|
-
|
|
18828
|
-
|
|
19291
|
+
if (this.core && this.core.loader && this.core.loader.finnalUrl) {
|
|
19292
|
+
log.cdn_play_url = this.core.loader.finnalUrl;
|
|
19293
|
+
} else {
|
|
19294
|
+
log.cdn_play_url = url && url.startsWith("//") ? window.location.protocol + url : url;
|
|
19295
|
+
}
|
|
19296
|
+
log.live_stream_session_id = getUrlQuery(log.cdn_play_url, "_session_id", "session_id");
|
|
19297
|
+
log.play_format = getPlayFormat(log.cdn_play_url);
|
|
18829
19298
|
log.timestamp = getCurrentTime();
|
|
18830
19299
|
var _getDeviceInfo = getDeviceInfo(), cpu_core_number = _getDeviceInfo.cpu_core_number, memory_usage = _getDeviceInfo.memory_usage, network_downlink = _getDeviceInfo.network_downlink;
|
|
18831
19300
|
log.cpu_core_number = cpu_core_number;
|
|
@@ -19051,6 +19520,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
19051
19520
|
};
|
|
19052
19521
|
_proto2.reportStartPlay = function reportStartPlay() {
|
|
19053
19522
|
if (!this.started) {
|
|
19523
|
+
this.core = getPlayerCore(this.player);
|
|
19524
|
+
if (this.core) {
|
|
19525
|
+
this.commonParams.live_sdk_version = "2";
|
|
19526
|
+
this.logmanager.core = this.core;
|
|
19527
|
+
}
|
|
19054
19528
|
this.started = true;
|
|
19055
19529
|
this.log.start_play.start_play_time = this.log.start_play.timestamp = getCurrentTime();
|
|
19056
19530
|
this.logmanager.push(this.log.start_play, true);
|
|
@@ -19315,6 +19789,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
19315
19789
|
this.core = getPlayerCore(this.player);
|
|
19316
19790
|
if (this.core) {
|
|
19317
19791
|
this.commonParams.live_sdk_version = "2";
|
|
19792
|
+
this.logmanager.core = this.core;
|
|
19318
19793
|
}
|
|
19319
19794
|
if (this.player.config.autoplay || this.player.config.videoInit) {
|
|
19320
19795
|
this.reportStartPlay();
|
|
@@ -20567,6 +21042,45 @@ var T = 4003, C = function() {
|
|
|
20567
21042
|
this.event("predefine_pageview", n2);
|
|
20568
21043
|
}, t2;
|
|
20569
21044
|
}(), q = new R("default");
|
|
21045
|
+
let getRandomValues;
|
|
21046
|
+
const rnds8 = new Uint8Array(16);
|
|
21047
|
+
function rng() {
|
|
21048
|
+
if (!getRandomValues) {
|
|
21049
|
+
getRandomValues = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto);
|
|
21050
|
+
if (!getRandomValues) {
|
|
21051
|
+
throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
21052
|
+
}
|
|
21053
|
+
}
|
|
21054
|
+
return getRandomValues(rnds8);
|
|
21055
|
+
}
|
|
21056
|
+
const byteToHex = [];
|
|
21057
|
+
for (let i2 = 0; i2 < 256; ++i2) {
|
|
21058
|
+
byteToHex.push((i2 + 256).toString(16).slice(1));
|
|
21059
|
+
}
|
|
21060
|
+
function unsafeStringify(arr, offset = 0) {
|
|
21061
|
+
return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + "-" + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + "-" + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + "-" + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + "-" + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
|
|
21062
|
+
}
|
|
21063
|
+
const randomUUID = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto);
|
|
21064
|
+
var native = {
|
|
21065
|
+
randomUUID
|
|
21066
|
+
};
|
|
21067
|
+
function v4(options, buf, offset) {
|
|
21068
|
+
if (native.randomUUID && !buf && !options) {
|
|
21069
|
+
return native.randomUUID();
|
|
21070
|
+
}
|
|
21071
|
+
options = options || {};
|
|
21072
|
+
const rnds = options.random || (options.rng || rng)();
|
|
21073
|
+
rnds[6] = rnds[6] & 15 | 64;
|
|
21074
|
+
rnds[8] = rnds[8] & 63 | 128;
|
|
21075
|
+
if (buf) {
|
|
21076
|
+
offset = offset || 0;
|
|
21077
|
+
for (let i2 = 0; i2 < 16; ++i2) {
|
|
21078
|
+
buf[offset + i2] = rnds[i2];
|
|
21079
|
+
}
|
|
21080
|
+
return buf;
|
|
21081
|
+
}
|
|
21082
|
+
return unsafeStringify(rnds);
|
|
21083
|
+
}
|
|
20570
21084
|
const DEVICE_ID_KEY = "veplayer_live_device_id";
|
|
20571
21085
|
const USER_ID_Key = "veplayer_live_user_id";
|
|
20572
21086
|
const genRandomID2 = (length) => {
|
|
@@ -20592,6 +21106,45 @@ const getUserId2 = () => {
|
|
|
20592
21106
|
localStorage.setItem(USER_ID_Key, userId);
|
|
20593
21107
|
return userId;
|
|
20594
21108
|
};
|
|
21109
|
+
const generateUrlWithSessionId = (url) => {
|
|
21110
|
+
var _a, _b;
|
|
21111
|
+
if (!url) {
|
|
21112
|
+
return "";
|
|
21113
|
+
}
|
|
21114
|
+
const withoutProtocol = url.startsWith("//");
|
|
21115
|
+
if (withoutProtocol) {
|
|
21116
|
+
url = location.protocol + url;
|
|
21117
|
+
}
|
|
21118
|
+
try {
|
|
21119
|
+
const urlObject = new URL(url);
|
|
21120
|
+
if ((_a = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _a.get("_session_id")) {
|
|
21121
|
+
return url;
|
|
21122
|
+
}
|
|
21123
|
+
(_b = urlObject == null ? void 0 : urlObject.searchParams) == null ? void 0 : _b.append("_session_id", generateSessionId());
|
|
21124
|
+
return urlObject.toString();
|
|
21125
|
+
} catch (error2) {
|
|
21126
|
+
return url;
|
|
21127
|
+
}
|
|
21128
|
+
};
|
|
21129
|
+
const hashCode = (str) => {
|
|
21130
|
+
str += "";
|
|
21131
|
+
let h2 = 0;
|
|
21132
|
+
let off = 0;
|
|
21133
|
+
const len = str.length;
|
|
21134
|
+
for (let i2 = 0; i2 < len; i2++) {
|
|
21135
|
+
h2 = 31 * h2 + str.charCodeAt(off++);
|
|
21136
|
+
if (h2 > 140737488355327 || h2 < -140737488355328) {
|
|
21137
|
+
h2 &= 281474976710655;
|
|
21138
|
+
}
|
|
21139
|
+
}
|
|
21140
|
+
if (h2 < 0) {
|
|
21141
|
+
h2 += 2251799813685247;
|
|
21142
|
+
}
|
|
21143
|
+
return h2;
|
|
21144
|
+
};
|
|
21145
|
+
const generateSessionId = () => {
|
|
21146
|
+
return v4().replace(/-/g, "") + "." + Date.now() + "." + hashCode(v4().replace(/-/g, ""));
|
|
21147
|
+
};
|
|
20595
21148
|
const CN_APPID = 468759;
|
|
20596
21149
|
const CHANNEL = "cn";
|
|
20597
21150
|
const CHANNEL_DOMAIN = "//mcs.volceapplog.com";
|
|
@@ -20670,10 +21223,10 @@ class Logger extends Plugin {
|
|
|
20670
21223
|
user_id: this._userId,
|
|
20671
21224
|
device_id: this._deviceId,
|
|
20672
21225
|
ext: {
|
|
20673
|
-
veplayer_version: "2.
|
|
20674
|
-
flv_version: "3.0.
|
|
20675
|
-
hls_version: "3.0.
|
|
20676
|
-
rts_version: "0.2.0-alpha.
|
|
21226
|
+
veplayer_version: "2.1.0-rc.0",
|
|
21227
|
+
flv_version: "3.0.10-alpha.4",
|
|
21228
|
+
hls_version: "3.0.10-alpha.4",
|
|
21229
|
+
rts_version: "0.2.0-alpha.5"
|
|
20677
21230
|
}
|
|
20678
21231
|
});
|
|
20679
21232
|
}
|
|
@@ -20950,25 +21503,51 @@ const LIVE_DEFAULT_OPTIONS = {
|
|
|
20950
21503
|
autoplay: { muted: true }
|
|
20951
21504
|
};
|
|
20952
21505
|
const LIVE_DEFAULT_PLUGINS = [...DEFAULT_PLUGINS, Refresh, Logger, InfoPanel];
|
|
21506
|
+
var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
|
|
21507
|
+
RTMCodec2["H264"] = "h264";
|
|
21508
|
+
return RTMCodec2;
|
|
21509
|
+
})(RTMCodec || {});
|
|
20953
21510
|
class VePlayerLive extends VePlayerBase {
|
|
21511
|
+
/**
|
|
21512
|
+
* @hidden
|
|
21513
|
+
* @param options
|
|
21514
|
+
*/
|
|
21515
|
+
constructor(options) {
|
|
21516
|
+
super(options);
|
|
21517
|
+
}
|
|
21518
|
+
/** {zh}
|
|
21519
|
+
* @brief 调用此方法开启直播日志上报。
|
|
21520
|
+
*/
|
|
20954
21521
|
openLog() {
|
|
20955
21522
|
var _a;
|
|
20956
21523
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.open();
|
|
20957
21524
|
}
|
|
21525
|
+
/** {zh}
|
|
21526
|
+
* @brief 调用此方法关闭直播日志上报。
|
|
21527
|
+
*/
|
|
20958
21528
|
closeLog() {
|
|
20959
21529
|
var _a;
|
|
20960
21530
|
(_a = this._player.plugins) == null ? void 0 : _a.logger.close();
|
|
20961
21531
|
}
|
|
21532
|
+
/** {zh}
|
|
21533
|
+
* @brief 调用此方法将打开直播信息面板,面板将展示拉流格式、帧率、码率、GOP、视频分辨率、编码方式、Buffer 水位、播放进度等基础信息。如果当前是软解,还会显示软解解码效率和解码消耗。
|
|
21534
|
+
*/
|
|
20962
21535
|
openInfoPanel() {
|
|
20963
21536
|
var _a;
|
|
20964
21537
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.open();
|
|
20965
21538
|
}
|
|
21539
|
+
/** {zh}
|
|
21540
|
+
* @brief 调用此方法关闭直播信息面板。
|
|
21541
|
+
*
|
|
21542
|
+
*/
|
|
20966
21543
|
closeInfoPanel() {
|
|
20967
21544
|
var _a;
|
|
20968
21545
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
20969
21546
|
}
|
|
20970
21547
|
}
|
|
20971
21548
|
async function createLivePlayer(options) {
|
|
21549
|
+
var _a, _b;
|
|
21550
|
+
let player = void 0;
|
|
20972
21551
|
if (!options || !options.url && !options.playlist) {
|
|
20973
21552
|
throw create(ErrorCode.INVALID_PARAMETER, new VeI18n());
|
|
20974
21553
|
}
|
|
@@ -20977,18 +21556,35 @@ async function createLivePlayer(options) {
|
|
|
20977
21556
|
...options,
|
|
20978
21557
|
plugins: [...LIVE_DEFAULT_PLUGINS, ...options.plugins ?? []]
|
|
20979
21558
|
};
|
|
20980
|
-
|
|
21559
|
+
player = await VePlayerBase.create(
|
|
20981
21560
|
{
|
|
20982
21561
|
...LIVE_DEFAULT_OPTIONS,
|
|
20983
21562
|
...finalOptions,
|
|
20984
21563
|
isLive: true,
|
|
20985
21564
|
i18nManager: i18n,
|
|
21565
|
+
preProcessUrl: (url) => {
|
|
21566
|
+
return {
|
|
21567
|
+
url: generateUrlWithSessionId(url)
|
|
21568
|
+
};
|
|
21569
|
+
},
|
|
20986
21570
|
async preparePlugins(url) {
|
|
20987
|
-
return getTypeStrategy({ ...finalOptions, url });
|
|
21571
|
+
return getTypeStrategy({ ...finalOptions, url }, player);
|
|
20988
21572
|
}
|
|
20989
21573
|
},
|
|
20990
21574
|
VePlayerLive
|
|
20991
21575
|
);
|
|
21576
|
+
if (player) {
|
|
21577
|
+
const RTMDegrade = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.config) == null ? void 0 : _b._RTMdegrade;
|
|
21578
|
+
if (RTMDegrade) {
|
|
21579
|
+
player.emit("degrade", {
|
|
21580
|
+
originRtmUrl: RTMDegrade._originRtmUrl,
|
|
21581
|
+
code: "NOT_SUPPORT",
|
|
21582
|
+
message: "not support rtm or h264",
|
|
21583
|
+
isRTMSupported: RTMDegrade._isRTMSupported,
|
|
21584
|
+
isRTMSupportCodec: RTMDegrade._isRTMSupportCodec
|
|
21585
|
+
});
|
|
21586
|
+
}
|
|
21587
|
+
}
|
|
20992
21588
|
return player;
|
|
20993
21589
|
}
|
|
20994
21590
|
var live = /* @__PURE__ */ Object.freeze({
|