@volcengine/veplayer 2.4.0-rc.2 → 2.4.0-rc.4
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/esm/index.d.ts +22 -6
- package/esm/veplayer.biz.live.development.js +194 -100
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +551 -104
- package/esm/veplayer.development.css +1 -1
- package/esm/veplayer.development.js +265 -132
- package/esm/veplayer.live.d.ts +551 -104
- package/esm/veplayer.live.development.css +1 -1
- package/esm/veplayer.live.development.js +265 -132
- package/esm/veplayer.live.production.css +1 -1
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.css +1 -1
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +22 -6
- package/esm/veplayer.vod.development.css +1 -1
- package/esm/veplayer.vod.development.js +65 -27
- package/esm/veplayer.vod.production.css +1 -1
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +22 -6
- package/umd/veplayer.biz.live.development.js +194 -100
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +551 -104
- package/umd/veplayer.development.css +1 -1
- package/umd/veplayer.development.js +265 -132
- package/umd/veplayer.live.d.ts +551 -104
- package/umd/veplayer.live.development.css +1 -1
- package/umd/veplayer.live.development.js +265 -132
- 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 +22 -6
- package/umd/veplayer.vod.development.css +1 -1
- package/umd/veplayer.vod.development.js +65 -27
- package/umd/veplayer.vod.production.css +1 -1
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +551 -104
- package/veplayer.live.d.ts +551 -104
- package/veplayer.vod.d.ts +22 -6
|
@@ -1461,7 +1461,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
1463
|
};
|
|
1464
|
-
var version = "3.0.
|
|
1464
|
+
var version = "3.0.19-rc.0";
|
|
1465
1465
|
var ERROR_TYPE_MAP = {
|
|
1466
1466
|
1: "media",
|
|
1467
1467
|
2: "media",
|
|
@@ -4546,7 +4546,11 @@ var __publicField = (obj, key, value) => {
|
|
|
4546
4546
|
_this._fullScreenOffset = null;
|
|
4547
4547
|
}
|
|
4548
4548
|
if (!_this.cssfullscreen) {
|
|
4549
|
-
|
|
4549
|
+
var el = _this._fullscreenEl;
|
|
4550
|
+
if (!el && (_this.root.contains(event.target) || event.target === _this.root)) {
|
|
4551
|
+
el = event.target;
|
|
4552
|
+
}
|
|
4553
|
+
_this.recoverFullStyle(_this.root, el, STATE_CLASS.FULLSCREEN);
|
|
4550
4554
|
} else {
|
|
4551
4555
|
_this.removeClass(STATE_CLASS.FULLSCREEN);
|
|
4552
4556
|
}
|
|
@@ -5494,6 +5498,9 @@ var __publicField = (obj, key, value) => {
|
|
|
5494
5498
|
value: function getFullscreen() {
|
|
5495
5499
|
var el = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.config.fullscreenTarget;
|
|
5496
5500
|
var root2 = this.root, media = this.media;
|
|
5501
|
+
if (el === "video" || el === "media") {
|
|
5502
|
+
el = this[el];
|
|
5503
|
+
}
|
|
5497
5504
|
if (!el) {
|
|
5498
5505
|
el = root2;
|
|
5499
5506
|
}
|
|
@@ -5728,19 +5735,15 @@ var __publicField = (obj, key, value) => {
|
|
|
5728
5735
|
this.isCanplay = true;
|
|
5729
5736
|
this.waitTimer && util$1.clearTimeout(this, this.waitTimer);
|
|
5730
5737
|
}
|
|
5731
|
-
}, {
|
|
5732
|
-
key: "onDurationchange",
|
|
5733
|
-
value: function onDurationchange() {
|
|
5734
|
-
if (this.__startTime > 0 && this.duration > 0) {
|
|
5735
|
-
this.currentTime = this.__startTime;
|
|
5736
|
-
this.__startTime = -1;
|
|
5737
|
-
}
|
|
5738
|
-
}
|
|
5739
5738
|
}, {
|
|
5740
5739
|
key: "onLoadeddata",
|
|
5741
5740
|
value: function onLoadeddata() {
|
|
5742
5741
|
this.isError = false;
|
|
5743
5742
|
this.isSeeking = false;
|
|
5743
|
+
if (this.__startTime > 0 && this.duration > 0) {
|
|
5744
|
+
this.currentTime = this.__startTime;
|
|
5745
|
+
this.__startTime = -1;
|
|
5746
|
+
}
|
|
5744
5747
|
}
|
|
5745
5748
|
}, {
|
|
5746
5749
|
key: "onLoadstart",
|
|
@@ -5843,7 +5846,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5843
5846
|
util$1.clearTimeout(this, this.waitTimer);
|
|
5844
5847
|
this.waitTimer = null;
|
|
5845
5848
|
}
|
|
5846
|
-
if (!this.paused && this.state
|
|
5849
|
+
if (!this.paused && this.state === STATES.NOTALLOW && this.duration) {
|
|
5847
5850
|
this.setState(STATES.RUNNING);
|
|
5848
5851
|
this.emit(AUTOPLAY_STARTED);
|
|
5849
5852
|
}
|
|
@@ -6095,8 +6098,9 @@ var __publicField = (obj, key, value) => {
|
|
|
6095
6098
|
}, {
|
|
6096
6099
|
key: "_preProcessUrl",
|
|
6097
6100
|
value: function _preProcessUrl(url, ext) {
|
|
6098
|
-
var
|
|
6099
|
-
|
|
6101
|
+
var _this$config7 = this.config, preProcessUrl = _this$config7.preProcessUrl, preProcessUrlOptions = _this$config7.preProcessUrlOptions;
|
|
6102
|
+
var processUrlOptions = Object.assign({}, preProcessUrlOptions, ext);
|
|
6103
|
+
return !util$1.isBlob(url) && typeof preProcessUrl === "function" ? preProcessUrl(url, processUrlOptions) : {
|
|
6100
6104
|
url
|
|
6101
6105
|
};
|
|
6102
6106
|
}
|
|
@@ -6789,13 +6793,23 @@ var __publicField = (obj, key, value) => {
|
|
|
6789
6793
|
});
|
|
6790
6794
|
}
|
|
6791
6795
|
}
|
|
6796
|
+
}, {
|
|
6797
|
+
key: "setConfig",
|
|
6798
|
+
value: function setConfig(config) {
|
|
6799
|
+
var _this2 = this;
|
|
6800
|
+
Object.keys(config).forEach(function(key) {
|
|
6801
|
+
_this2.config[key] = config[key];
|
|
6802
|
+
});
|
|
6803
|
+
var poster = this.config.poster;
|
|
6804
|
+
this.update(poster);
|
|
6805
|
+
}
|
|
6792
6806
|
}, {
|
|
6793
6807
|
key: "onTimeUpdate",
|
|
6794
6808
|
value: function onTimeUpdate() {
|
|
6795
|
-
var
|
|
6809
|
+
var _this3 = this;
|
|
6796
6810
|
if (!this.player.currentTime) {
|
|
6797
6811
|
this.once(TIME_UPDATE, function() {
|
|
6798
|
-
|
|
6812
|
+
_this3.onTimeUpdate();
|
|
6799
6813
|
});
|
|
6800
6814
|
} else {
|
|
6801
6815
|
util$1.removeClass(this.root, "xg-showplay");
|
|
@@ -8310,7 +8324,6 @@ var __publicField = (obj, key, value) => {
|
|
|
8310
8324
|
if (scope === -1 || scope > 0 && !config.gestureY || scope === 0 && !config.gestureX) {
|
|
8311
8325
|
return;
|
|
8312
8326
|
}
|
|
8313
|
-
e2.cancelable && e2.preventDefault();
|
|
8314
8327
|
_this.executeMove(diffx, diffy, scope, pos.width, pos.height);
|
|
8315
8328
|
pos.x = x2;
|
|
8316
8329
|
pos.y = y2;
|
|
@@ -8352,8 +8365,7 @@ var __publicField = (obj, key, value) => {
|
|
|
8352
8365
|
}
|
|
8353
8366
|
});
|
|
8354
8367
|
_defineProperty$1(_assertThisInitialized(_this), "onRootTouchEnd", function(e2) {
|
|
8355
|
-
if (_this.pos.
|
|
8356
|
-
e2.stopPropagation();
|
|
8368
|
+
if (_this.pos.scope > -1) {
|
|
8357
8369
|
_this.onTouchEnd(e2);
|
|
8358
8370
|
}
|
|
8359
8371
|
});
|
|
@@ -8426,6 +8438,13 @@ var __publicField = (obj, key, value) => {
|
|
|
8426
8438
|
});
|
|
8427
8439
|
player.root.addEventListener("touchmove", this.onRootTouchMove, true);
|
|
8428
8440
|
player.root.addEventListener("touchend", this.onRootTouchEnd, true);
|
|
8441
|
+
player.root.addEventListener("touchcancel", this.onRootTouchEnd, true);
|
|
8442
|
+
var controls = this.player.controls;
|
|
8443
|
+
if (controls && controls.center) {
|
|
8444
|
+
controls.center.addEventListener("touchmove", this.onRootTouchMove, true);
|
|
8445
|
+
controls.center.addEventListener("touchend", this.onRootTouchEnd, true);
|
|
8446
|
+
controls.center.addEventListener("touchcancel", this.onRootTouchEnd, true);
|
|
8447
|
+
}
|
|
8429
8448
|
this.on(DURATION_CHANGE, function() {
|
|
8430
8449
|
var player2 = _this2.player, config2 = _this2.config;
|
|
8431
8450
|
if (player2.duration * 1e3 < config2.moveDuration) {
|
|
@@ -8825,6 +8844,13 @@ var __publicField = (obj, key, value) => {
|
|
|
8825
8844
|
this.touch = null;
|
|
8826
8845
|
player.root.removeEventListener("touchmove", this.onRootTouchMove, true);
|
|
8827
8846
|
player.root.removeEventListener("touchend", this.onRootTouchEnd, true);
|
|
8847
|
+
player.root.removeEventListener("touchcancel", this.onRootTouchEnd, true);
|
|
8848
|
+
var controls = this.player.controls;
|
|
8849
|
+
if (controls && controls.center) {
|
|
8850
|
+
controls.center.removeEventListener("touchmove", this.onRootTouchMove, true);
|
|
8851
|
+
controls.center.removeEventListener("touchend", this.onRootTouchEnd, true);
|
|
8852
|
+
controls.center.removeEventListener("touchcancel", this.onRootTouchEnd, true);
|
|
8853
|
+
}
|
|
8828
8854
|
}
|
|
8829
8855
|
}, {
|
|
8830
8856
|
key: "render",
|
|
@@ -9962,7 +9988,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9962
9988
|
var _this$player2 = this.player, volume = _this$player2.volume, muted = _this$player2.muted;
|
|
9963
9989
|
var $labelValue = this.find(".xgplayer-value-label");
|
|
9964
9990
|
var vol = Math.max(Math.min(volume, 1), 0);
|
|
9965
|
-
$labelValue.innerText = muted ? 0 : Math.
|
|
9991
|
+
$labelValue.innerText = muted ? 0 : Math.round(vol * 100);
|
|
9966
9992
|
}
|
|
9967
9993
|
}, {
|
|
9968
9994
|
key: "focus",
|
|
@@ -10420,7 +10446,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10420
10446
|
}
|
|
10421
10447
|
this.onItemClick = this.onItemClick.bind(this);
|
|
10422
10448
|
this.renderItemList();
|
|
10423
|
-
var eventName =
|
|
10449
|
+
var eventName = this.config.domEventType === "touch" ? "touchend" : "click";
|
|
10424
10450
|
this._delegates = Plugin.delegate.call(this, this.root, "li", eventName, this.onItemClick);
|
|
10425
10451
|
}
|
|
10426
10452
|
_createClass$1(OptionList2, [{
|
|
@@ -10624,9 +10650,9 @@ var __publicField = (obj, key, value) => {
|
|
|
10624
10650
|
AUTOPLAY_SUCCESS: "autoplaySuccess",
|
|
10625
10651
|
ERROR_REFRESH_CLICK: "errorRefreshClick",
|
|
10626
10652
|
SOURCE_CHANGE: "sourceChange",
|
|
10627
|
-
|
|
10628
|
-
|
|
10629
|
-
|
|
10653
|
+
ABR_SWITCH_START: "abrSwitchStart",
|
|
10654
|
+
ABR_SWITCH_SUCCESS: "abrSwitchSuccess",
|
|
10655
|
+
ABR_SWITCH_FAILED: "abrSwitchFailed"
|
|
10630
10656
|
};
|
|
10631
10657
|
const Events$1 = {
|
|
10632
10658
|
...XGEvents,
|
|
@@ -10673,14 +10699,14 @@ var __publicField = (obj, key, value) => {
|
|
|
10673
10699
|
[BaseEvents.DOWNLOAD_SPEED_CHANGE]: {
|
|
10674
10700
|
event: DOWNLOAD_SPEED_CHANGE
|
|
10675
10701
|
},
|
|
10676
|
-
[BaseEvents.
|
|
10702
|
+
[BaseEvents.ABR_SWITCH_START]: {
|
|
10677
10703
|
event: "switch_definition_start"
|
|
10678
10704
|
},
|
|
10679
|
-
[BaseEvents.
|
|
10705
|
+
[BaseEvents.ABR_SWITCH_SUCCESS]: {
|
|
10680
10706
|
event: "switch_definition_success"
|
|
10681
10707
|
},
|
|
10682
|
-
[BaseEvents.
|
|
10683
|
-
event: "
|
|
10708
|
+
[BaseEvents.ABR_SWITCH_FAILED]: {
|
|
10709
|
+
event: "switch_definition_fail"
|
|
10684
10710
|
}
|
|
10685
10711
|
};
|
|
10686
10712
|
function transform(event, callback) {
|
|
@@ -13715,6 +13741,13 @@ var __publicField = (obj, key, value) => {
|
|
|
13715
13741
|
var _a;
|
|
13716
13742
|
return (_a = this._sourceManager.source) == null ? void 0 : _a.name;
|
|
13717
13743
|
}
|
|
13744
|
+
/** {zh}
|
|
13745
|
+
* 获取播放器版本号
|
|
13746
|
+
* @returns
|
|
13747
|
+
*/
|
|
13748
|
+
get playerVersion() {
|
|
13749
|
+
return "2.4.0-rc.4";
|
|
13750
|
+
}
|
|
13718
13751
|
/** {zh}
|
|
13719
13752
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
13720
13753
|
*/
|
|
@@ -14059,6 +14092,11 @@ var __publicField = (obj, key, value) => {
|
|
|
14059
14092
|
blur(data) {
|
|
14060
14093
|
return this._player.blur(data);
|
|
14061
14094
|
}
|
|
14095
|
+
/** {zh}
|
|
14096
|
+
* @brief 判断浏览器是否支持播放格式
|
|
14097
|
+
* @param type 播放格式
|
|
14098
|
+
* @returns
|
|
14099
|
+
*/
|
|
14062
14100
|
canPlayType(type) {
|
|
14063
14101
|
return this._player.canPlayType(type);
|
|
14064
14102
|
}
|
|
@@ -18818,11 +18856,12 @@ var __publicField = (obj, key, value) => {
|
|
|
18818
18856
|
}
|
|
18819
18857
|
}
|
|
18820
18858
|
const getFlvStrategy = async (options) => {
|
|
18821
|
-
var _a, _b, _c;
|
|
18859
|
+
var _a, _b, _c, _d, _e, _f;
|
|
18822
18860
|
let mseStrategy;
|
|
18823
18861
|
let softStrategy;
|
|
18824
18862
|
const enableLowLatency = ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.enableLowLatency) && sniffer$1.device === "pc";
|
|
18825
|
-
const
|
|
18863
|
+
const enableFrameChasing = ((_c = (_b = options == null ? void 0 : options.flv) == null ? void 0 : _b.lowLatency) == null ? void 0 : _c.enableFrameChasing) ?? true;
|
|
18864
|
+
const abrPts = ((_e = (_d = options == null ? void 0 : options.flv) == null ? void 0 : _d.lowLatency) == null ? void 0 : _e.abrPts) ?? "-800";
|
|
18826
18865
|
const codec = await getCodec(options);
|
|
18827
18866
|
const isSoftDecode$1 = await isSoftDecode(options, codec);
|
|
18828
18867
|
if (isSoftDecode$1) {
|
|
@@ -18839,7 +18878,7 @@ var __publicField = (obj, key, value) => {
|
|
|
18839
18878
|
(mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
|
|
18840
18879
|
(softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
|
|
18841
18880
|
]);
|
|
18842
|
-
(softModule == null ? void 0 : softModule.XGVideoPlugin) && ((
|
|
18881
|
+
(softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_f = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _f.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
|
|
18843
18882
|
const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
|
|
18844
18883
|
const plugins = [];
|
|
18845
18884
|
if (enableLowLatency) {
|
|
@@ -18847,7 +18886,7 @@ var __publicField = (obj, key, value) => {
|
|
|
18847
18886
|
}
|
|
18848
18887
|
if (mseModule) {
|
|
18849
18888
|
plugins.push(mseModule.FlvPlugin);
|
|
18850
|
-
if (enableLowLatency) {
|
|
18889
|
+
if (enableLowLatency && enableFrameChasing) {
|
|
18851
18890
|
plugins.push(mseModule.Adaptive);
|
|
18852
18891
|
}
|
|
18853
18892
|
}
|
|
@@ -19854,7 +19893,7 @@ var __publicField = (obj, key, value) => {
|
|
|
19854
19893
|
live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
|
|
19855
19894
|
player_sdk_version: player.version,
|
|
19856
19895
|
// eslint-disable-next-line no-undef
|
|
19857
|
-
logger_version: "1.1.0-alpha.
|
|
19896
|
+
logger_version: "1.1.0-alpha.10",
|
|
19858
19897
|
// 由rollup 在编译时注入
|
|
19859
19898
|
report_version: "5",
|
|
19860
19899
|
product_line: options.product_line,
|
|
@@ -20658,9 +20697,29 @@ var __publicField = (obj, key, value) => {
|
|
|
20658
20697
|
play_current_time: _this7.player.currentTime
|
|
20659
20698
|
}, _this7.videoSize));
|
|
20660
20699
|
return Promise.resolve(_this7.getRtcStats(playedTime, first)).then(function(stats) {
|
|
20661
|
-
|
|
20700
|
+
var flvStats = {};
|
|
20701
|
+
if (_this7.core) {
|
|
20702
|
+
if (_this7.core.getStats) {
|
|
20703
|
+
var _ref2 = _this7.core.getStats() || {}, bitrate = _ref2.bitrate, avgSpeed = _ref2.avgSpeed;
|
|
20704
|
+
Object.assign(flvStats, {
|
|
20705
|
+
bitrate,
|
|
20706
|
+
avg_speed: avgSpeed,
|
|
20707
|
+
rate: avgSpeed / bitrate
|
|
20708
|
+
});
|
|
20709
|
+
}
|
|
20710
|
+
if (_this7.core.getNetWorkInfo) {
|
|
20711
|
+
var _this7$core$core;
|
|
20712
|
+
var _ref3 = _this7.core.getNetWorkInfo() || {}, lostRate = _ref3.lostRate;
|
|
20713
|
+
var _ref4 = ((_this7$core$core = _this7.core.core) === null || _this7$core$core === void 0 ? void 0 : _this7$core$core._opts) || {}, networkEvaluateInterval = _ref4.networkEvaluateInterval;
|
|
20714
|
+
Object.assign(flvStats, {
|
|
20715
|
+
lostRate,
|
|
20716
|
+
networkEvaluateInterval
|
|
20717
|
+
});
|
|
20718
|
+
}
|
|
20719
|
+
}
|
|
20720
|
+
_this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
|
|
20662
20721
|
play_time: first ? 0 : playedTime
|
|
20663
|
-
}, stats)), true);
|
|
20722
|
+
}, stats), flvStats)), true);
|
|
20664
20723
|
_this7.log.playing.download_speed_array = [];
|
|
20665
20724
|
_this7.log.playing.stall_time = 0;
|
|
20666
20725
|
_this7.log.playing.stall_count = 0;
|
|
@@ -20681,7 +20740,7 @@ var __publicField = (obj, key, value) => {
|
|
|
20681
20740
|
_this9.player.off("playing", _this9.handlePlayerPlaying);
|
|
20682
20741
|
_this9.player.off("timeupdate", _this9.handlePlayerPlaying);
|
|
20683
20742
|
if (_this9.core) {
|
|
20684
|
-
var
|
|
20743
|
+
var _ref5 = _this9.core.getStats() || {}, fps = _ref5.fps;
|
|
20685
20744
|
_this9.commonParams.fps = fps;
|
|
20686
20745
|
}
|
|
20687
20746
|
return Promise.resolve(_this9.reportPlaying(true)).then(function() {
|
|
@@ -20692,7 +20751,7 @@ var __publicField = (obj, key, value) => {
|
|
|
20692
20751
|
var _temp4 = function() {
|
|
20693
20752
|
if (Math.abs(Date.now() - _this9.log.playing.timestamp - timer) < 100 || Date.now() - _this9.log.playing.timestamp >= timer) {
|
|
20694
20753
|
var _temp5 = function() {
|
|
20695
|
-
if (!_this9.player.video) {
|
|
20754
|
+
if (!_this9.player || !_this9.player.video) {
|
|
20696
20755
|
_this9.destroyFunc();
|
|
20697
20756
|
} else {
|
|
20698
20757
|
var _temp6 = function() {
|
|
@@ -20925,24 +20984,30 @@ var __publicField = (obj, key, value) => {
|
|
|
20925
20984
|
this.player.off("bufferappend", this.handleBufferAppend);
|
|
20926
20985
|
this.player.off("core_event", this.handleCoreEvent);
|
|
20927
20986
|
this.player.off("degrade", this.handleDegrade);
|
|
20928
|
-
this.clearPlayingInterval();
|
|
20929
|
-
this.clearStallTimer();
|
|
20930
|
-
this.clearPlayResultTimer();
|
|
20931
|
-
clearTimeout(this.collectDownloadSpeedTimer);
|
|
20932
20987
|
this._player = null;
|
|
20933
20988
|
}
|
|
20934
|
-
};
|
|
20935
|
-
_proto2.handleUserLeave = function handleUserLeave() {
|
|
20936
|
-
if (this.destroyed || !this.started) {
|
|
20937
|
-
return;
|
|
20938
|
-
}
|
|
20939
|
-
this.destroyed = true;
|
|
20940
|
-
this.updatePlayStopParams();
|
|
20941
|
-
this.reportPlayStop();
|
|
20942
20989
|
this.clearPlayingInterval();
|
|
20943
20990
|
this.clearStallTimer();
|
|
20991
|
+
this.clearPlayResultTimer();
|
|
20944
20992
|
clearTimeout(this.collectDownloadSpeedTimer);
|
|
20945
|
-
|
|
20993
|
+
};
|
|
20994
|
+
_proto2.handleUserLeave = function handleUserLeave() {
|
|
20995
|
+
try {
|
|
20996
|
+
var _this15 = this;
|
|
20997
|
+
if (_this15.destroyed || !_this15.started) {
|
|
20998
|
+
return Promise.resolve();
|
|
20999
|
+
}
|
|
21000
|
+
_this15.destroyed = true;
|
|
21001
|
+
return Promise.resolve(_this15.updatePlayStopParams()).then(function() {
|
|
21002
|
+
_this15.reportPlayStop();
|
|
21003
|
+
_this15.clearPlayingInterval();
|
|
21004
|
+
_this15.clearStallTimer();
|
|
21005
|
+
clearTimeout(_this15.collectDownloadSpeedTimer);
|
|
21006
|
+
_this15.removeWindowListener();
|
|
21007
|
+
});
|
|
21008
|
+
} catch (e2) {
|
|
21009
|
+
return Promise.reject(e2);
|
|
21010
|
+
}
|
|
20946
21011
|
};
|
|
20947
21012
|
_proto2.saveBuffered = function saveBuffered() {
|
|
20948
21013
|
try {
|
|
@@ -20965,8 +21030,10 @@ var __publicField = (obj, key, value) => {
|
|
|
20965
21030
|
}
|
|
20966
21031
|
};
|
|
20967
21032
|
_proto2.reportPlayStop = function reportPlayStop() {
|
|
20968
|
-
|
|
20969
|
-
|
|
21033
|
+
if (this.player) {
|
|
21034
|
+
this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
|
|
21035
|
+
this.saveBuffered();
|
|
21036
|
+
}
|
|
20970
21037
|
this.logmanager.push(this.log.play_stop, true);
|
|
20971
21038
|
};
|
|
20972
21039
|
_proto2.reportFirstframe = function reportFirstframe() {
|
|
@@ -20974,7 +21041,7 @@ var __publicField = (obj, key, value) => {
|
|
|
20974
21041
|
return;
|
|
20975
21042
|
}
|
|
20976
21043
|
if (this.core) {
|
|
20977
|
-
var
|
|
21044
|
+
var _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
|
|
20978
21045
|
this.commonParams.fps = fps;
|
|
20979
21046
|
}
|
|
20980
21047
|
this.firstFrameViewed = true;
|
|
@@ -20993,47 +21060,79 @@ var __publicField = (obj, key, value) => {
|
|
|
20993
21060
|
this.log.play_stop.is_stream_received = 1;
|
|
20994
21061
|
};
|
|
20995
21062
|
_proto2.updatePlayStopParams = function updatePlayStopParams() {
|
|
20996
|
-
|
|
20997
|
-
|
|
20998
|
-
|
|
20999
|
-
|
|
21000
|
-
|
|
21001
|
-
|
|
21002
|
-
|
|
21003
|
-
|
|
21004
|
-
|
|
21005
|
-
|
|
21006
|
-
|
|
21007
|
-
|
|
21008
|
-
|
|
21009
|
-
|
|
21010
|
-
|
|
21011
|
-
|
|
21012
|
-
|
|
21013
|
-
|
|
21014
|
-
|
|
21015
|
-
|
|
21016
|
-
|
|
21017
|
-
|
|
21018
|
-
|
|
21019
|
-
|
|
21020
|
-
|
|
21021
|
-
|
|
21022
|
-
|
|
21023
|
-
|
|
21024
|
-
|
|
21025
|
-
|
|
21026
|
-
|
|
21027
|
-
|
|
21028
|
-
|
|
21029
|
-
|
|
21030
|
-
|
|
21031
|
-
|
|
21032
|
-
|
|
21033
|
-
|
|
21034
|
-
|
|
21035
|
-
|
|
21036
|
-
|
|
21063
|
+
try {
|
|
21064
|
+
var _this17$core;
|
|
21065
|
+
var _temp9 = function _temp92() {
|
|
21066
|
+
Object.assign(play_stop, _objectSpread2({
|
|
21067
|
+
timestamp: endTime,
|
|
21068
|
+
stop_time: endTime,
|
|
21069
|
+
duration: _this17.playedTime / 1e3,
|
|
21070
|
+
play_time: _this17.playedTime / 1e3
|
|
21071
|
+
}, _this17.videoSize));
|
|
21072
|
+
if (_this17.errorNumber === 0) {
|
|
21073
|
+
play_stop.play_time_on_no_frame = play_stop.stop_time - _this17.log.start_play.start_play_time;
|
|
21074
|
+
}
|
|
21075
|
+
};
|
|
21076
|
+
var _this17 = this;
|
|
21077
|
+
var timing = getResourceTiming(_this17._url);
|
|
21078
|
+
var endTime = getCurrentTime();
|
|
21079
|
+
_this17.playedTime = endTime - _this17.log.start_play.start_play_time;
|
|
21080
|
+
var play_stop = _this17.log.play_stop;
|
|
21081
|
+
Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
|
|
21082
|
+
stall_time: 0
|
|
21083
|
+
}));
|
|
21084
|
+
if (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
|
|
21085
|
+
play_stop.stall_time += endTime - _this17.inWaitingStart;
|
|
21086
|
+
}
|
|
21087
|
+
_this17.inWaitingStart = 0;
|
|
21088
|
+
Object.assign(play_stop, _objectSpread2({
|
|
21089
|
+
stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
|
|
21090
|
+
// 计算百秒卡顿时长
|
|
21091
|
+
stall_count_per_100sec: play_stop.stall_count * 1e3 / _this17.playedTime * 100
|
|
21092
|
+
}, timing));
|
|
21093
|
+
if (_this17.log.play_stop.stall_count_per_100sec === 0) {
|
|
21094
|
+
_this17.log.play_stop.stall_time_per_100sec = 0;
|
|
21095
|
+
}
|
|
21096
|
+
if (_this17.log.play_stop.stall_time_per_100sec > 100 || _this17.log.play_stop.stall_time_per_100sec < 0) {
|
|
21097
|
+
return Promise.resolve();
|
|
21098
|
+
}
|
|
21099
|
+
if (_this17.log.playing.index) {
|
|
21100
|
+
Object.assign(_this17.log.playing, _objectSpread2({
|
|
21101
|
+
timestamp: getCurrentTime(),
|
|
21102
|
+
is_last: 1
|
|
21103
|
+
}, _this17.videoSize));
|
|
21104
|
+
_this17.logmanager.push(_this17.log.playing, true);
|
|
21105
|
+
} else {
|
|
21106
|
+
_this17.log.play_stop.error_code = _this17.log.play_error.code;
|
|
21107
|
+
_this17.log.play_stop.error_info = _this17.log.play_error.info;
|
|
21108
|
+
}
|
|
21109
|
+
endTime = getCurrentTime();
|
|
21110
|
+
if ((_this17$core = _this17.core) === null || _this17$core === void 0 ? void 0 : _this17$core.getStats) {
|
|
21111
|
+
var _ref7 = _this17.core.getStats() || {}, totalReceivedByte = _ref7.totalReceivedByte, totalReceivedCost = _ref7.totalReceivedCost;
|
|
21112
|
+
Object.assign(_this17.log.play_stop, {
|
|
21113
|
+
totalReceivedByte,
|
|
21114
|
+
totalReceivedCost,
|
|
21115
|
+
totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
|
|
21116
|
+
// bps
|
|
21117
|
+
});
|
|
21118
|
+
}
|
|
21119
|
+
var _temp10 = function() {
|
|
21120
|
+
var _this17$core2;
|
|
21121
|
+
if ((_this17$core2 = _this17.core) === null || _this17$core2 === void 0 ? void 0 : _this17$core2.getStatsSnapshoot) {
|
|
21122
|
+
return Promise.resolve(_this17.core.getStatsSnapshoot()).then(function(_ref8) {
|
|
21123
|
+
var video = _ref8.video;
|
|
21124
|
+
var _ref9 = video || {}, packetsLost = _ref9.packetsLost, packetsReceived = _ref9.packetsReceived;
|
|
21125
|
+
Object.assign(play_stop, {
|
|
21126
|
+
packetsLost,
|
|
21127
|
+
packetsReceived,
|
|
21128
|
+
totalLostRate: packetsLost / (packetsLost + packetsReceived)
|
|
21129
|
+
});
|
|
21130
|
+
});
|
|
21131
|
+
}
|
|
21132
|
+
}();
|
|
21133
|
+
return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
|
|
21134
|
+
} catch (e2) {
|
|
21135
|
+
return Promise.reject(e2);
|
|
21037
21136
|
}
|
|
21038
21137
|
};
|
|
21039
21138
|
_proto2.clearPlayingInterval = function clearPlayingInterval() {
|
|
@@ -21899,9 +21998,9 @@ var __publicField = (obj, key, value) => {
|
|
|
21899
21998
|
user_id: this._userId,
|
|
21900
21999
|
device_id: this._deviceId,
|
|
21901
22000
|
ext: {
|
|
21902
|
-
veplayer_version: "2.4.0-rc.
|
|
21903
|
-
flv_version: "3.0.
|
|
21904
|
-
hls_version: "3.0.
|
|
22001
|
+
veplayer_version: "2.4.0-rc.4",
|
|
22002
|
+
flv_version: "3.0.19-rc.0",
|
|
22003
|
+
hls_version: "3.0.19-rc.0",
|
|
21905
22004
|
rts_version: "0.2.1-alpha.0"
|
|
21906
22005
|
}
|
|
21907
22006
|
});
|
|
@@ -22199,8 +22298,9 @@ var __publicField = (obj, key, value) => {
|
|
|
22199
22298
|
const getAbrStrategy = async (options) => {
|
|
22200
22299
|
var _a, _b;
|
|
22201
22300
|
const streamType = options.url && getStreamType(options.url);
|
|
22202
|
-
if (streamType === "rtm")
|
|
22301
|
+
if (streamType === "rtm") {
|
|
22203
22302
|
return {};
|
|
22303
|
+
}
|
|
22204
22304
|
const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
|
|
22205
22305
|
if (!abrOptions) {
|
|
22206
22306
|
return {};
|
|
@@ -22248,6 +22348,23 @@ var __publicField = (obj, key, value) => {
|
|
|
22248
22348
|
constructor(options) {
|
|
22249
22349
|
super(options);
|
|
22250
22350
|
}
|
|
22351
|
+
/** {zh}
|
|
22352
|
+
* @brief 获取已经播放的时间
|
|
22353
|
+
*/
|
|
22354
|
+
get playTime() {
|
|
22355
|
+
var _a, _b, _c, _d;
|
|
22356
|
+
if (!((_b = (_a = this._player) == null ? void 0 : _a.played) == null ? void 0 : _b.length)) {
|
|
22357
|
+
return 0;
|
|
22358
|
+
}
|
|
22359
|
+
const length = this._player.played.length;
|
|
22360
|
+
let time = 0;
|
|
22361
|
+
for (let index = 0; index < length; index++) {
|
|
22362
|
+
const start = (_c = this._player) == null ? void 0 : _c.played.start(index);
|
|
22363
|
+
const end = (_d = this._player) == null ? void 0 : _d.played.end(index);
|
|
22364
|
+
time += end - start;
|
|
22365
|
+
}
|
|
22366
|
+
return time;
|
|
22367
|
+
}
|
|
22251
22368
|
/** {zh}
|
|
22252
22369
|
* @brief 调用此方法开启直播日志上报。
|
|
22253
22370
|
*/
|
|
@@ -22290,13 +22407,33 @@ var __publicField = (obj, key, value) => {
|
|
|
22290
22407
|
var _a;
|
|
22291
22408
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
22292
22409
|
}
|
|
22410
|
+
/** {zh}
|
|
22411
|
+
* @brief 打开 Abr
|
|
22412
|
+
*/
|
|
22293
22413
|
openAbr() {
|
|
22294
|
-
var _a, _b;
|
|
22295
|
-
|
|
22414
|
+
var _a, _b, _c, _d;
|
|
22415
|
+
const streamType = this.url && getStreamType(this.url);
|
|
22416
|
+
if (streamType === "flv") {
|
|
22417
|
+
(_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
|
|
22418
|
+
return;
|
|
22419
|
+
}
|
|
22420
|
+
if (streamType === "hls") {
|
|
22421
|
+
(_d = (_c = this._player.plugins) == null ? void 0 : _c.hlsabr) == null ? void 0 : _d.switchAbr(true);
|
|
22422
|
+
}
|
|
22296
22423
|
}
|
|
22424
|
+
/** {zh}
|
|
22425
|
+
* @brief 关闭 Abr
|
|
22426
|
+
*/
|
|
22297
22427
|
closeAbr() {
|
|
22298
|
-
var _a, _b;
|
|
22299
|
-
|
|
22428
|
+
var _a, _b, _c, _d;
|
|
22429
|
+
const streamType = this.url && getStreamType(this.url);
|
|
22430
|
+
if (streamType === "flv") {
|
|
22431
|
+
(_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
|
|
22432
|
+
return;
|
|
22433
|
+
}
|
|
22434
|
+
if (streamType === "hls") {
|
|
22435
|
+
(_d = (_c = this._player.plugins) == null ? void 0 : _c.hlsabr) == null ? void 0 : _d.switchAbr(false);
|
|
22436
|
+
}
|
|
22300
22437
|
}
|
|
22301
22438
|
/** {zh}
|
|
22302
22439
|
* @brief 调用此方法更新 DRM 鉴权配置。
|
|
@@ -22306,52 +22443,48 @@ var __publicField = (obj, key, value) => {
|
|
|
22306
22443
|
var _a, _b, _c;
|
|
22307
22444
|
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
22308
22445
|
}
|
|
22309
|
-
|
|
22446
|
+
/** {zh}
|
|
22447
|
+
* @brief 切换 flv Abr
|
|
22448
|
+
* @param options 切换 Abr 的配置。
|
|
22449
|
+
* @returns
|
|
22450
|
+
*/
|
|
22451
|
+
switchAbr(options) {
|
|
22310
22452
|
var _a, _b;
|
|
22311
22453
|
if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
|
|
22312
22454
|
return;
|
|
22313
22455
|
}
|
|
22314
|
-
if (typeof bitrate !== "undefined") {
|
|
22315
|
-
const url = this._player.plugins.abr.config.urls[bitrate];
|
|
22456
|
+
if (typeof (options == null ? void 0 : options.bitrate) !== "undefined") {
|
|
22457
|
+
const url = this._player.plugins.abr.config.urls[options.bitrate];
|
|
22316
22458
|
if (!url) {
|
|
22317
22459
|
return;
|
|
22318
22460
|
}
|
|
22319
22461
|
this.switch(url, { seamless: true });
|
|
22320
|
-
this._player.plugins.abr.bitrate = bitrate;
|
|
22321
|
-
}
|
|
22322
|
-
if (typeof enable !== "undefined") {
|
|
22323
|
-
(_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(enable);
|
|
22324
|
-
}
|
|
22325
|
-
}
|
|
22326
|
-
async switch(target, options) {
|
|
22327
|
-
var _a, _b, _c;
|
|
22328
|
-
const { abr, ...rest } = options ?? {};
|
|
22329
|
-
if (abr) {
|
|
22330
|
-
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
|
|
22331
|
-
}
|
|
22332
|
-
return super.switch(target, rest);
|
|
22333
|
-
}
|
|
22334
|
-
getPlayTime() {
|
|
22335
|
-
var _a, _b, _c, _d;
|
|
22336
|
-
if (!((_b = (_a = this._player) == null ? void 0 : _a.played) == null ? void 0 : _b.length)) {
|
|
22337
|
-
return 0;
|
|
22462
|
+
this._player.plugins.abr.bitrate = options.bitrate;
|
|
22338
22463
|
}
|
|
22339
|
-
|
|
22340
|
-
|
|
22341
|
-
for (let index = 0; index < length; index++) {
|
|
22342
|
-
const start = (_c = this._player) == null ? void 0 : _c.played.start(index);
|
|
22343
|
-
const end = (_d = this._player) == null ? void 0 : _d.played.end(index);
|
|
22344
|
-
time += end - start;
|
|
22464
|
+
if (typeof (options == null ? void 0 : options.enable) !== "undefined") {
|
|
22465
|
+
(_b = this._player.plugins) == null ? void 0 : _b.abr.switchAbr(options.enable);
|
|
22345
22466
|
}
|
|
22346
|
-
return time;
|
|
22347
|
-
}
|
|
22348
|
-
getPlayerVersion() {
|
|
22349
|
-
return "2.4.0-rc.2";
|
|
22350
22467
|
}
|
|
22468
|
+
/** {zh}
|
|
22469
|
+
* @brief 获取 RTM 的网络相关信息
|
|
22470
|
+
* @returns
|
|
22471
|
+
*/
|
|
22351
22472
|
getRTMNetWorkInfo() {
|
|
22352
22473
|
var _a, _b, _c;
|
|
22353
22474
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
|
|
22354
22475
|
}
|
|
22476
|
+
/** {zh}
|
|
22477
|
+
* @brief 获取 RTM 播放信息
|
|
22478
|
+
* @returns
|
|
22479
|
+
*/
|
|
22480
|
+
async getRTMStats() {
|
|
22481
|
+
var _a, _b, _c;
|
|
22482
|
+
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot();
|
|
22483
|
+
}
|
|
22484
|
+
/** {zh}
|
|
22485
|
+
* @brief 获取 FLV 播放信息
|
|
22486
|
+
* @returns
|
|
22487
|
+
*/
|
|
22355
22488
|
getFLVStats() {
|
|
22356
22489
|
var _a, _b, _c;
|
|
22357
22490
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|