@volcengine/veplayer 2.7.0 → 2.7.1-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/index.d.ts +64 -2
- package/esm/veplayer.biz.live.development.js +342 -228
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +96 -5
- package/esm/veplayer.development.js +347 -228
- package/esm/veplayer.live.d.ts +96 -5
- package/esm/veplayer.live.development.js +347 -228
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +64 -2
- package/esm/veplayer.vod.development.js +7 -2
- package/esm/veplayer.vod.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +64 -2
- package/umd/veplayer.biz.live.development.js +342 -228
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +96 -5
- package/umd/veplayer.development.js +347 -228
- package/umd/veplayer.live.d.ts +96 -5
- package/umd/veplayer.live.development.js +347 -228
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +64 -2
- package/umd/veplayer.vod.development.js +7 -2
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +96 -5
- package/veplayer.live.d.ts +96 -5
- package/veplayer.vod.d.ts +64 -2
|
@@ -14189,10 +14189,15 @@ const transformOption = (
|
|
|
14189
14189
|
* @param options 更多配置信息。
|
|
14190
14190
|
*/
|
|
14191
14191
|
(options) => {
|
|
14192
|
+
var _a, _b;
|
|
14192
14193
|
const { autoplay: autoplay2, ...rest } = options;
|
|
14193
14194
|
const xgOptions = rest;
|
|
14194
14195
|
if (xgOptions.poster) {
|
|
14195
|
-
xgOptions.poster
|
|
14196
|
+
if (typeof xgOptions.poster === "string") {
|
|
14197
|
+
xgOptions.poster = escapeHtml(xgOptions.poster);
|
|
14198
|
+
} else if (typeof ((_a = xgOptions.poster) == null ? void 0 : _a.poster) === "string") {
|
|
14199
|
+
xgOptions.poster.poster = escapeHtml((_b = xgOptions.poster) == null ? void 0 : _b.poster);
|
|
14200
|
+
}
|
|
14196
14201
|
}
|
|
14197
14202
|
xgOptions.icons = {
|
|
14198
14203
|
...DEFAULT_ICONS,
|
|
@@ -14444,7 +14449,7 @@ class VePlayerBase {
|
|
|
14444
14449
|
* @brief Retrieve the player SDK version number.
|
|
14445
14450
|
*/
|
|
14446
14451
|
get playerVersion() {
|
|
14447
|
-
return "2.7.
|
|
14452
|
+
return "2.7.1-rc.1";
|
|
14448
14453
|
}
|
|
14449
14454
|
/** {zh}
|
|
14450
14455
|
* @brief 获取当前播放视频的清晰度唯一标识(definition)。
|
|
@@ -20040,6 +20045,19 @@ function _objectSpread2(target) {
|
|
|
20040
20045
|
}
|
|
20041
20046
|
return target;
|
|
20042
20047
|
}
|
|
20048
|
+
typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /* @__PURE__ */ Symbol("Symbol.iterator")) : "@@iterator";
|
|
20049
|
+
typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /* @__PURE__ */ Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
|
20050
|
+
function _catch(body, recover) {
|
|
20051
|
+
try {
|
|
20052
|
+
var result = body();
|
|
20053
|
+
} catch (e3) {
|
|
20054
|
+
return recover(e3);
|
|
20055
|
+
}
|
|
20056
|
+
if (result && result.then) {
|
|
20057
|
+
return result.then(void 0, recover);
|
|
20058
|
+
}
|
|
20059
|
+
return result;
|
|
20060
|
+
}
|
|
20043
20061
|
var device_id_key = "xgplayer_device_id";
|
|
20044
20062
|
var user_id_key = "xgplayer_user_id";
|
|
20045
20063
|
var getCookie = function getCookie2(key) {
|
|
@@ -20243,17 +20261,25 @@ function getPlayerCore(player) {
|
|
|
20243
20261
|
return player.plugins.hls;
|
|
20244
20262
|
} else if (player.plugins.rts) {
|
|
20245
20263
|
return player.plugins.rts;
|
|
20246
|
-
} else if (player.plugins.
|
|
20247
|
-
return player.plugins.
|
|
20264
|
+
} else if (player.plugins.flvlive) {
|
|
20265
|
+
return player.plugins.flvlive;
|
|
20266
|
+
} else if (player.plugins.hlslive) {
|
|
20267
|
+
return player.plugins.hlslive;
|
|
20268
|
+
} else if (player.plugins.hlsvod) {
|
|
20269
|
+
return player.plugins.hlsvod;
|
|
20270
|
+
} else if (player.plugins.hlslivemobile) {
|
|
20271
|
+
return player.plugins.hlslivemobile;
|
|
20272
|
+
} else if (player.plugins.flvlivemobile) {
|
|
20273
|
+
return player.plugins.flvlivemobile;
|
|
20248
20274
|
}
|
|
20249
20275
|
}
|
|
20250
|
-
return
|
|
20276
|
+
return player.newHls || player.newFlv || player.__core__ || player.flv;
|
|
20251
20277
|
}
|
|
20252
20278
|
function getDefaultOptions(options) {
|
|
20253
20279
|
return {
|
|
20254
20280
|
device_id: options.device_id || getDeviceID$1(),
|
|
20255
20281
|
user_id: options.user_id || getUserId$1(),
|
|
20256
|
-
error_report_stop:
|
|
20282
|
+
error_report_stop: typeof options.error_report_stop === "boolean" ? options.error_report_stop : true,
|
|
20257
20283
|
project_key: options.project_key || "live",
|
|
20258
20284
|
product_line: options.product_line || "live",
|
|
20259
20285
|
onReport: options.onReport || function() {
|
|
@@ -20476,9 +20502,8 @@ function getCommonLog(options) {
|
|
|
20476
20502
|
live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
|
|
20477
20503
|
player_sdk_version: player.version,
|
|
20478
20504
|
// eslint-disable-next-line no-undef
|
|
20479
|
-
logger_version: "1.1.0-alpha.
|
|
20505
|
+
logger_version: "1.1.0-alpha.17",
|
|
20480
20506
|
// 由rollup 在编译时注入
|
|
20481
|
-
report_version: "5",
|
|
20482
20507
|
product_line: options.product_line,
|
|
20483
20508
|
user_id: options.user_id,
|
|
20484
20509
|
device_id: options.device_id,
|
|
@@ -20487,6 +20512,7 @@ function getCommonLog(options) {
|
|
|
20487
20512
|
cdn_ip: options.cdn_ip,
|
|
20488
20513
|
is_wasm: +(!!mediaType && mediaType !== "video"),
|
|
20489
20514
|
review_is_live: player.config.isLive ? 2 : 1,
|
|
20515
|
+
isSupportedH265: isCodecSupport("hev1.1.6.L93.B0,mp4a.40.2"),
|
|
20490
20516
|
aid: options.aid,
|
|
20491
20517
|
live_id: options.live_id || options.aid + "-" + options.user_id + "-" + Date.now(),
|
|
20492
20518
|
is_preview: options.is_preview ? 1 : 0,
|
|
@@ -20612,6 +20638,7 @@ var Manage = /* @__PURE__ */ function() {
|
|
|
20612
20638
|
log.cpu_core_number = cpu_core_number;
|
|
20613
20639
|
log.memory_usage = memory_usage;
|
|
20614
20640
|
log.network_downlink = network_downlink;
|
|
20641
|
+
log.muted = +this._player.muted;
|
|
20615
20642
|
Object.assign(log, _objectSpread2({}, this.videoSize));
|
|
20616
20643
|
this.send(log);
|
|
20617
20644
|
};
|
|
@@ -20642,14 +20669,29 @@ var getNetStat = function getNetStat2() {
|
|
|
20642
20669
|
}
|
|
20643
20670
|
return "unknown";
|
|
20644
20671
|
};
|
|
20645
|
-
var videoEvts = [
|
|
20672
|
+
var videoEvts = [
|
|
20673
|
+
"play",
|
|
20674
|
+
"playing",
|
|
20675
|
+
"pause",
|
|
20676
|
+
"ended",
|
|
20677
|
+
// 'error',
|
|
20678
|
+
"seeking",
|
|
20679
|
+
"seeked",
|
|
20680
|
+
"timeupdate",
|
|
20681
|
+
"waiting",
|
|
20682
|
+
"canplay",
|
|
20683
|
+
"canplaythrough",
|
|
20684
|
+
"durationchange",
|
|
20685
|
+
"ratechange",
|
|
20686
|
+
"volumechange",
|
|
20687
|
+
"loadeddata"
|
|
20688
|
+
];
|
|
20646
20689
|
var LoggerControl = /* @__PURE__ */ function() {
|
|
20647
20690
|
function LoggerControl2(options) {
|
|
20648
20691
|
this.options = options;
|
|
20649
20692
|
this.logger = new XgLiveLogger(options);
|
|
20650
20693
|
this.restart = this.restart.bind(this);
|
|
20651
20694
|
this.bindUrlChange();
|
|
20652
|
-
sniffer.browser.includes("Chrome");
|
|
20653
20695
|
}
|
|
20654
20696
|
var _proto = LoggerControl2.prototype;
|
|
20655
20697
|
_proto.restart = function restart(report_stop) {
|
|
@@ -20673,6 +20715,9 @@ var LoggerControl = /* @__PURE__ */ function() {
|
|
|
20673
20715
|
this.logger.updateExt(ext);
|
|
20674
20716
|
}
|
|
20675
20717
|
};
|
|
20718
|
+
_proto.sendLog = function sendLog(log) {
|
|
20719
|
+
this.logger.sendLog(log);
|
|
20720
|
+
};
|
|
20676
20721
|
_proto.destroy = function destroy2(report_stop) {
|
|
20677
20722
|
this.logger.destroy(report_stop);
|
|
20678
20723
|
this.logger = null;
|
|
@@ -20734,6 +20779,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
20734
20779
|
this.completed = false;
|
|
20735
20780
|
this.firstFrameViewed = false;
|
|
20736
20781
|
this.cacheRtcStats = {};
|
|
20782
|
+
this.cachePlaying = {};
|
|
20737
20783
|
}
|
|
20738
20784
|
var _proto2 = XgLiveLogger2.prototype;
|
|
20739
20785
|
_proto2.setNTP = function setNTP(ntp) {
|
|
@@ -20823,6 +20869,14 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
20823
20869
|
});
|
|
20824
20870
|
}
|
|
20825
20871
|
};
|
|
20872
|
+
_proto2.sendLog = function sendLog(log) {
|
|
20873
|
+
for (var commonKey in this.commonParams) {
|
|
20874
|
+
if (log[commonKey] === void 0) {
|
|
20875
|
+
log[commonKey] = this["_" + commonKey] || this.commonParams[commonKey];
|
|
20876
|
+
}
|
|
20877
|
+
}
|
|
20878
|
+
this.logmanager.push(log);
|
|
20879
|
+
};
|
|
20826
20880
|
_proto2.updateExt = function updateExt(ext) {
|
|
20827
20881
|
for (var logKey in this.log) {
|
|
20828
20882
|
for (var extKey in ext) {
|
|
@@ -20961,9 +21015,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
20961
21015
|
};
|
|
20962
21016
|
};
|
|
20963
21017
|
_proto2.handleTTFB = function handleTTFB(params) {
|
|
20964
|
-
var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed;
|
|
21018
|
+
var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed, responseUrl = _ref.responseUrl, url = _ref.url;
|
|
20965
21019
|
this.log.first_frame.ttfb = elapsed || -1;
|
|
20966
21020
|
this.log.first_frame.ttfb_end = end || 0;
|
|
21021
|
+
this.log.first_frame.is_redirect = +(url !== responseUrl);
|
|
21022
|
+
this.log.play_result.is_redirect = this.log.first_frame.is_redirect;
|
|
20967
21023
|
};
|
|
20968
21024
|
_proto2.handleUrlChange = function handleUrlChange(url) {
|
|
20969
21025
|
this.logmanager.push(Object.assign(this.log.play_url_change, {
|
|
@@ -21015,11 +21071,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21015
21071
|
this.clearPlayResultTimer();
|
|
21016
21072
|
this.log.play_result.reason = err.message || "first frame failed";
|
|
21017
21073
|
this.log.play_result.code = this.log.play_error.code;
|
|
21018
|
-
this.logmanager.push(this.log.play_result
|
|
21074
|
+
this.logmanager.push(this.log.play_result);
|
|
21019
21075
|
}
|
|
21020
21076
|
}
|
|
21021
21077
|
if (this.options.error_report_stop) {
|
|
21022
|
-
this.
|
|
21078
|
+
this.destroy(true);
|
|
21023
21079
|
} else {
|
|
21024
21080
|
this.updatePlayStopParams();
|
|
21025
21081
|
}
|
|
@@ -21043,22 +21099,36 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21043
21099
|
this.logmanager.push(play_stream_loaded);
|
|
21044
21100
|
};
|
|
21045
21101
|
_proto2.handleSEIParsed = function handleSEIParsed(sei) {
|
|
21046
|
-
|
|
21047
|
-
|
|
21048
|
-
var
|
|
21049
|
-
|
|
21050
|
-
|
|
21051
|
-
|
|
21052
|
-
|
|
21053
|
-
|
|
21054
|
-
|
|
21055
|
-
|
|
21056
|
-
|
|
21057
|
-
|
|
21058
|
-
|
|
21059
|
-
|
|
21060
|
-
|
|
21061
|
-
|
|
21102
|
+
try {
|
|
21103
|
+
var _this5 = this;
|
|
21104
|
+
var _this5$log = _this5.log, playing = _this5$log.playing, first_frame = _this5$log.first_frame;
|
|
21105
|
+
var _temp3 = function() {
|
|
21106
|
+
if (sei.code === 100) {
|
|
21107
|
+
var seiString = Utf8ArrayToStr(sei.content);
|
|
21108
|
+
seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
|
|
21109
|
+
var _temp4 = _catch(function() {
|
|
21110
|
+
var seiContent = JSON.parse(seiString);
|
|
21111
|
+
return Promise.resolve(_this5.getPlayerBuffer()).then(function(bufferTime) {
|
|
21112
|
+
var seiDelay = bufferTime + _this5.ntpTime - seiContent.ts;
|
|
21113
|
+
playing.sei_delay = seiDelay;
|
|
21114
|
+
playing.sei_source = seiContent.source;
|
|
21115
|
+
playing.ntp_sync = _this5.options.ntp ? 1 : 0;
|
|
21116
|
+
playing.ntp_delta = _this5.ntp_delta;
|
|
21117
|
+
first_frame.first_sei_delay = seiDelay;
|
|
21118
|
+
first_frame.ntp_sync = _this5.options.ntp ? 1 : 0;
|
|
21119
|
+
first_frame.ntp_delta = _this5.ntp_delta;
|
|
21120
|
+
});
|
|
21121
|
+
}, function() {
|
|
21122
|
+
});
|
|
21123
|
+
if (_temp4 && _temp4.then)
|
|
21124
|
+
return _temp4.then(function() {
|
|
21125
|
+
});
|
|
21126
|
+
}
|
|
21127
|
+
}();
|
|
21128
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function() {
|
|
21129
|
+
}) : void 0);
|
|
21130
|
+
} catch (e3) {
|
|
21131
|
+
return Promise.reject(e3);
|
|
21062
21132
|
}
|
|
21063
21133
|
};
|
|
21064
21134
|
_proto2.handleMetaDataLoaded = function handleMetaDataLoaded(type, meta) {
|
|
@@ -21088,7 +21158,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21088
21158
|
_proto2.handleAVUnsync = function handleAVUnsync(unsyncInfo) {
|
|
21089
21159
|
Object.assign(this.log.play_av_unsync, unsyncInfo || {});
|
|
21090
21160
|
this.log.play_av_unsync.timestamp = getCurrentTime();
|
|
21091
|
-
this.logmanager.push(this.log.play_av_unsync
|
|
21161
|
+
this.logmanager.push(this.log.play_av_unsync);
|
|
21092
21162
|
};
|
|
21093
21163
|
_proto2.handleStreamException = function handleStreamException(info) {
|
|
21094
21164
|
this.logmanager.push(Object.assign({}, this.log.stream_exception, info));
|
|
@@ -21108,27 +21178,58 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21108
21178
|
}
|
|
21109
21179
|
};
|
|
21110
21180
|
_proto2.getPlayerBuffer = function getPlayerBuffer() {
|
|
21111
|
-
|
|
21112
|
-
|
|
21113
|
-
|
|
21114
|
-
|
|
21115
|
-
|
|
21116
|
-
|
|
21117
|
-
|
|
21118
|
-
|
|
21119
|
-
|
|
21120
|
-
|
|
21181
|
+
try {
|
|
21182
|
+
var _this7 = this;
|
|
21183
|
+
return Promise.resolve(_this7.getRtcStats({
|
|
21184
|
+
onlyJb: true
|
|
21185
|
+
})).then(function(rtc_stats) {
|
|
21186
|
+
if (rtc_stats.video_jb_delay !== void 0) {
|
|
21187
|
+
return rtc_stats.video_jb_delay;
|
|
21188
|
+
}
|
|
21189
|
+
var buffered = _this7.player.video.buffered;
|
|
21190
|
+
if (buffered) {
|
|
21191
|
+
var bufferIdx = Math.max(0, buffered.length - 1);
|
|
21192
|
+
try {
|
|
21193
|
+
var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - _this7.player.video.currentTime) * 1e3);
|
|
21194
|
+
_this7.log.playing.audio_buffer_time = _this7.log.playing.video_buffer_time = bufferedTime;
|
|
21195
|
+
return bufferedTime;
|
|
21196
|
+
} catch (e3) {
|
|
21197
|
+
return 0;
|
|
21198
|
+
}
|
|
21199
|
+
}
|
|
21200
|
+
});
|
|
21201
|
+
} catch (e3) {
|
|
21202
|
+
return Promise.reject(e3);
|
|
21121
21203
|
}
|
|
21122
21204
|
};
|
|
21205
|
+
_proto2.getTransferCost = function getTransferCost(isFirstFrame) {
|
|
21206
|
+
var _this$core;
|
|
21207
|
+
if (!((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.transferCost)) {
|
|
21208
|
+
return {};
|
|
21209
|
+
}
|
|
21210
|
+
if (isFirstFrame)
|
|
21211
|
+
return this.core.transferCost;
|
|
21212
|
+
var _this$core$transferCo = this.core.transferCost, demuxCost = _this$core$transferCo.demuxCost, remuxCost = _this$core$transferCo.remuxCost, appendCost = _this$core$transferCo.appendCost;
|
|
21213
|
+
var transferCost = {
|
|
21214
|
+
demuxCost: demuxCost - this.cachePlaying.demuxCost,
|
|
21215
|
+
remuxCost: remuxCost - this.cachePlaying.remuxCost,
|
|
21216
|
+
appendCost: appendCost - this.cachePlaying.appendCost
|
|
21217
|
+
};
|
|
21218
|
+
Object.assign(this.cachePlaying, this.core.transferCost);
|
|
21219
|
+
return transferCost;
|
|
21220
|
+
};
|
|
21123
21221
|
_proto2.getPlayerDownloadSpeed = function getPlayerDownloadSpeed() {
|
|
21124
21222
|
if (this.core && this.core.core) {
|
|
21125
21223
|
if (typeof this.core.core.speedInfo === "function") {
|
|
21126
|
-
return this.core.core.speedInfo().speed;
|
|
21224
|
+
return this.core.core.speedInfo().speed || {};
|
|
21127
21225
|
}
|
|
21128
21226
|
}
|
|
21227
|
+
return {};
|
|
21129
21228
|
};
|
|
21130
21229
|
_proto2.getPlayerQuality = function getPlayerQuality() {
|
|
21131
21230
|
var video = this.player.video;
|
|
21231
|
+
if (!video)
|
|
21232
|
+
return;
|
|
21132
21233
|
if (video.getVideoPlaybackQuality) {
|
|
21133
21234
|
var quality = video.getVideoPlaybackQuality();
|
|
21134
21235
|
this.log.playing.drop_count = quality.droppedVideoFrames - this.tempDroppedFrameCount;
|
|
@@ -21142,10 +21243,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21142
21243
|
this.tempDroppedFrameCount = droppedVideoFrames;
|
|
21143
21244
|
}
|
|
21144
21245
|
};
|
|
21145
|
-
_proto2.getRtcStats = function getRtcStats(
|
|
21246
|
+
_proto2.getRtcStats = function getRtcStats(_ref2) {
|
|
21247
|
+
var _ref2$duration = _ref2.duration, duration = _ref2$duration === void 0 ? 1e3 : _ref2$duration, _ref2$onlyJb = _ref2.onlyJb, onlyJb = _ref2$onlyJb === void 0 ? false : _ref2$onlyJb;
|
|
21146
21248
|
try {
|
|
21147
|
-
var
|
|
21148
|
-
var rtm =
|
|
21249
|
+
var _this9 = this;
|
|
21250
|
+
var rtm = _this9.player.plugins.rts || _this9.player.plugins.rtm;
|
|
21149
21251
|
var pc = rtm && rtm.pc;
|
|
21150
21252
|
var rtc_stats = {};
|
|
21151
21253
|
if (!pc)
|
|
@@ -21156,53 +21258,56 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21156
21258
|
switch (type) {
|
|
21157
21259
|
case "inbound-rtp":
|
|
21158
21260
|
if (mediaType === "audio") {
|
|
21159
|
-
rtc_stats.audio_bytes_received = bytesReceived - (
|
|
21160
|
-
|
|
21161
|
-
rtc_stats.audio_packets_lost = packetsLost - (
|
|
21162
|
-
rtc_stats.audio_packets_received = packetsReceived - (
|
|
21163
|
-
|
|
21164
|
-
|
|
21261
|
+
rtc_stats.audio_bytes_received = bytesReceived - (_this9.cacheRtcStats.audioBytesReceived || 0);
|
|
21262
|
+
_this9.cacheRtcStats.audioBytesReceived = bytesReceived;
|
|
21263
|
+
rtc_stats.audio_packets_lost = packetsLost - (_this9.cacheRtcStats.audioPacketsLost || 0);
|
|
21264
|
+
rtc_stats.audio_packets_received = packetsReceived - (_this9.cacheRtcStats.audioPacketsReceived || 0);
|
|
21265
|
+
_this9.cacheRtcStats.audioPacketsLost = packetsLost;
|
|
21266
|
+
_this9.cacheRtcStats.audioPacketsReceived = packetsReceived;
|
|
21165
21267
|
rtc_stats.audio_level = audioLevel;
|
|
21166
21268
|
rtc_stats.concealment_event = concealmentEvents;
|
|
21167
21269
|
rtc_stats.audio_fraction_lost = rtc_stats.audio_packets_lost / rtc_stats.audio_packets_received;
|
|
21168
|
-
if (
|
|
21169
|
-
rtc_stats.audio_rec_sample_rate = (totalSamplesReceived -
|
|
21270
|
+
if (_this9.cacheRtcStats.totalSamplesReceived !== void 0) {
|
|
21271
|
+
rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this9.cacheRtcStats.totalSamplesReceived) / duration;
|
|
21170
21272
|
}
|
|
21171
|
-
|
|
21273
|
+
_this9.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
|
|
21172
21274
|
rtc_stats.concealed_samples = concealedSamples;
|
|
21173
21275
|
rtc_stats.total_samples_received = totalSamplesReceived;
|
|
21174
21276
|
} else {
|
|
21277
|
+
rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
|
|
21278
|
+
if (onlyJb) {
|
|
21279
|
+
return rtc_stats;
|
|
21280
|
+
}
|
|
21175
21281
|
rtc_stats.frames_dropped = framesDropped;
|
|
21176
21282
|
rtc_stats.iframes_decoded = keyFramesDecoded;
|
|
21177
|
-
rtc_stats.video_bytes_received = bytesReceived - (
|
|
21178
|
-
|
|
21283
|
+
rtc_stats.video_bytes_received = bytesReceived - (_this9.cacheRtcStats.videoBytesReceived || 0);
|
|
21284
|
+
_this9.cacheRtcStats.videoBytesReceived = bytesReceived;
|
|
21179
21285
|
rtc_stats.video_dec_time = totalDecodeTime;
|
|
21180
21286
|
rtc_stats.video_decoded_delay_ms = rtc_stats.video_dec_elapse / framesDecoded;
|
|
21181
21287
|
rtc_stats.video_frame_height = frameHeight;
|
|
21182
21288
|
rtc_stats.video_frame_width = frameWidth;
|
|
21183
|
-
if (
|
|
21184
|
-
rtc_stats.video_decode_framerate = (framesDecoded -
|
|
21289
|
+
if (_this9.cacheRtcStats.framesDecoded !== void 0) {
|
|
21290
|
+
rtc_stats.video_decode_framerate = (framesDecoded - _this9.cacheRtcStats.framesDecoded) / duration;
|
|
21185
21291
|
}
|
|
21186
|
-
|
|
21187
|
-
if (
|
|
21188
|
-
rtc_stats.video_recv_framerate = (framesReceived -
|
|
21292
|
+
_this9.cacheRtcStats.framesDecoded = framesDecoded;
|
|
21293
|
+
if (_this9.cacheRtcStats.framesReceived !== void 0) {
|
|
21294
|
+
rtc_stats.video_recv_framerate = (framesReceived - _this9.cacheRtcStats.framesReceived) / duration;
|
|
21189
21295
|
}
|
|
21190
|
-
if (
|
|
21191
|
-
rtc_stats.freeze_count = freezeCount -
|
|
21192
|
-
rtc_stats.freeze_duration = totalFreezesDuration -
|
|
21296
|
+
if (_this9.cacheRtcStats.freezeCount !== void 0) {
|
|
21297
|
+
rtc_stats.freeze_count = freezeCount - _this9.cacheRtcStats.freezeCount;
|
|
21298
|
+
rtc_stats.freeze_duration = totalFreezesDuration - _this9.cacheRtcStats.totalFreezesDuration;
|
|
21193
21299
|
}
|
|
21194
|
-
|
|
21195
|
-
|
|
21196
|
-
|
|
21300
|
+
_this9.cacheRtcStats.freezeCount = freezeCount;
|
|
21301
|
+
_this9.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
|
|
21302
|
+
_this9.cacheRtcStats.framesReceived = framesReceived;
|
|
21197
21303
|
rtc_stats.total_pauses_duration = totalPausesDuration;
|
|
21198
|
-
rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
|
|
21199
21304
|
rtc_stats.video_jitter = jitter * 1e3;
|
|
21200
21305
|
rtc_stats.video_nack_count = nackCount;
|
|
21201
|
-
rtc_stats.video_packets_lost = packetsLost - (
|
|
21202
|
-
rtc_stats.video_packets_received = packetsReceived - (
|
|
21306
|
+
rtc_stats.video_packets_lost = packetsLost - (_this9.cacheRtcStats.videoPacketsLost || 0);
|
|
21307
|
+
rtc_stats.video_packets_received = packetsReceived - (_this9.cacheRtcStats.videoPacketsReceived || 0);
|
|
21203
21308
|
rtc_stats.video_fraction_lost = rtc_stats.video_packets_lost / rtc_stats.video_packets_received;
|
|
21204
|
-
|
|
21205
|
-
|
|
21309
|
+
_this9.cacheRtcStats.videoPacketsLost = packetsLost;
|
|
21310
|
+
_this9.cacheRtcStats.videoPacketsReceived = packetsReceived;
|
|
21206
21311
|
rtc_stats.video_pli_count = pliCount;
|
|
21207
21312
|
rtc_stats.decoder_name = decoderImplementation;
|
|
21208
21313
|
}
|
|
@@ -21226,13 +21331,12 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21226
21331
|
rtc_stats.audio_codec = mediaType;
|
|
21227
21332
|
}
|
|
21228
21333
|
}
|
|
21229
|
-
rtc_stats.total_delay = rtc_stats.e2e_delay_ms + (rtc_stats.video_decoded_delay_ms || 0) + (rtc_stats.video_jb_delay || 0);
|
|
21230
21334
|
});
|
|
21231
|
-
Object.assign(
|
|
21335
|
+
Object.assign(_this9.log.playing, {
|
|
21232
21336
|
video_download_size: rtc_stats.video_bytes_received,
|
|
21233
21337
|
decode_fps: rtc_stats.video_decode_framerate,
|
|
21234
|
-
sei_delay: rtc_stats.total_delay,
|
|
21235
|
-
sei_network_delay: rtc_stats.e2e_delay_ms,
|
|
21338
|
+
// sei_delay: rtc_stats.total_delay,
|
|
21339
|
+
// sei_network_delay: rtc_stats.e2e_delay_ms,
|
|
21236
21340
|
width: rtc_stats.video_frame_width,
|
|
21237
21341
|
height: rtc_stats.video_frame_height,
|
|
21238
21342
|
current_speed: (rtc_stats.audio_bytes_received + rtc_stats.video_bytes_received) / duration
|
|
@@ -21245,31 +21349,34 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21245
21349
|
};
|
|
21246
21350
|
_proto2.reportPlaying = function reportPlaying(first) {
|
|
21247
21351
|
try {
|
|
21248
|
-
var
|
|
21249
|
-
if (
|
|
21250
|
-
|
|
21251
|
-
|
|
21252
|
-
|
|
21352
|
+
var _this11 = this;
|
|
21353
|
+
if (_this11.commonParams.is_wasm) {
|
|
21354
|
+
_this11.commonParams.fps = _this11.player.video.fps;
|
|
21355
|
+
_this11.log.playing.render_fps = _this11.player.video.fps;
|
|
21356
|
+
_this11.log.playing.decode_fps = _this11.player.video.decodeFps;
|
|
21253
21357
|
}
|
|
21254
|
-
|
|
21255
|
-
var lastPlayingTime =
|
|
21358
|
+
_this11.log.playing.index++;
|
|
21359
|
+
var lastPlayingTime = _this11.log.playing.timestamp;
|
|
21256
21360
|
var stallTime;
|
|
21257
|
-
if (
|
|
21258
|
-
stallTime = Math.min(
|
|
21361
|
+
if (_this11.inWaitingStart && _this11.inWaitingStart < getCurrentTime()) {
|
|
21362
|
+
stallTime = Math.min(_this11.options.playingInterval || _this11.log.playing.play_time, getCurrentTime() - Math.max(_this11.inWaitingStart, lastPlayingTime));
|
|
21259
21363
|
}
|
|
21260
|
-
|
|
21261
|
-
|
|
21262
|
-
|
|
21263
|
-
|
|
21364
|
+
_this11.getPlayerQuality();
|
|
21365
|
+
_this11.getPlayerBuffer();
|
|
21366
|
+
var transferCost = _this11.getTransferCost(false);
|
|
21367
|
+
if (!_this11.options.downloadSpeedInterval) {
|
|
21368
|
+
var _this11$getPlayerDown = _this11.getPlayerDownloadSpeed(), speed = _this11$getPlayerDown.speed, avgSpeed = _this11$getPlayerDown.avgSpeed;
|
|
21369
|
+
_this11.log.playing.current_speed = speed;
|
|
21370
|
+
_this11.log.playing.avg_speed = avgSpeed;
|
|
21264
21371
|
}
|
|
21265
21372
|
var now2 = getCurrentTime();
|
|
21266
21373
|
var playedTime = now2 - lastPlayingTime;
|
|
21267
|
-
var stall_time = (stallTime > 200 ? stallTime : 0) +
|
|
21268
|
-
var stall_count = (stallTime > 200 ? 1 : 0) +
|
|
21269
|
-
if (
|
|
21270
|
-
|
|
21374
|
+
var stall_time = (stallTime > 200 ? stallTime : 0) + _this11.log.playing.stall_time;
|
|
21375
|
+
var stall_count = (stallTime > 200 ? 1 : 0) + _this11.log.playing.stall_count;
|
|
21376
|
+
if (_this11.options.aggregationDowngradeStallTime) {
|
|
21377
|
+
_this11.log.playing.aggregation_downgrade_stall = (stallTime > _this11.options.aggregationDowngradeStallTime ? stallTime : 0) + (_this11.log.playing.aggregation_downgrade_stall || 0);
|
|
21271
21378
|
}
|
|
21272
|
-
Object.assign(
|
|
21379
|
+
Object.assign(_this11.log.playing, _objectSpread2(_objectSpread2({
|
|
21273
21380
|
timestamp: now2,
|
|
21274
21381
|
// 60s内存在多次触发playing
|
|
21275
21382
|
stop_time: now2,
|
|
@@ -21281,37 +21388,41 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21281
21388
|
stall_count,
|
|
21282
21389
|
// playing前会有一次卡顿现处于waiting状态
|
|
21283
21390
|
stall_time,
|
|
21284
|
-
play_current_time:
|
|
21285
|
-
},
|
|
21286
|
-
return Promise.resolve(
|
|
21391
|
+
play_current_time: _this11.player.currentTime
|
|
21392
|
+
}, transferCost), _this11.videoSize));
|
|
21393
|
+
return Promise.resolve(_this11.getRtcStats({
|
|
21394
|
+
duration: playedTime,
|
|
21395
|
+
first,
|
|
21396
|
+
onlyJb: false
|
|
21397
|
+
})).then(function(stats) {
|
|
21287
21398
|
var flvStats = {};
|
|
21288
|
-
if (
|
|
21289
|
-
if (
|
|
21290
|
-
var
|
|
21399
|
+
if (_this11.core) {
|
|
21400
|
+
if (_this11.core.getStats) {
|
|
21401
|
+
var _ref3 = _this11.core.getStats() || {}, bitrate = _ref3.bitrate, _avgSpeed = _ref3.avgSpeed;
|
|
21291
21402
|
Object.assign(flvStats, {
|
|
21292
21403
|
bitrate,
|
|
21293
|
-
avg_speed:
|
|
21294
|
-
rate:
|
|
21404
|
+
avg_speed: _avgSpeed,
|
|
21405
|
+
rate: _avgSpeed / bitrate
|
|
21295
21406
|
});
|
|
21296
21407
|
}
|
|
21297
|
-
if (
|
|
21298
|
-
var
|
|
21299
|
-
var
|
|
21300
|
-
var
|
|
21408
|
+
if (_this11.core.getNetWorkInfo) {
|
|
21409
|
+
var _this11$core$core;
|
|
21410
|
+
var _ref4 = _this11.core.getNetWorkInfo() || {}, lostRate = _ref4.lostRate;
|
|
21411
|
+
var _ref5 = ((_this11$core$core = _this11.core.core) === null || _this11$core$core === void 0 ? void 0 : _this11$core$core._opts) || {}, networkEvaluateInterval = _ref5.networkEvaluateInterval;
|
|
21301
21412
|
Object.assign(flvStats, {
|
|
21302
21413
|
lostRate,
|
|
21303
21414
|
networkEvaluateInterval
|
|
21304
21415
|
});
|
|
21305
21416
|
}
|
|
21306
21417
|
}
|
|
21307
|
-
|
|
21418
|
+
_this11.logmanager.push(Object.assign({}, _this11.log.playing, _objectSpread2(_objectSpread2({
|
|
21308
21419
|
play_time: first ? 0 : playedTime
|
|
21309
21420
|
}, stats), flvStats)), true);
|
|
21310
|
-
|
|
21311
|
-
|
|
21312
|
-
|
|
21313
|
-
if (
|
|
21314
|
-
|
|
21421
|
+
_this11.log.playing.download_speed_array = [];
|
|
21422
|
+
_this11.log.playing.stall_time = 0;
|
|
21423
|
+
_this11.log.playing.stall_count = 0;
|
|
21424
|
+
if (_this11.options.aggregationDowngradeStallTime) {
|
|
21425
|
+
_this11.log.playing.aggregation_downgrade_stall = 0;
|
|
21315
21426
|
}
|
|
21316
21427
|
});
|
|
21317
21428
|
} catch (e3) {
|
|
@@ -21320,64 +21431,71 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21320
21431
|
};
|
|
21321
21432
|
_proto2.handlePlayerPlaying = function handlePlayerPlaying() {
|
|
21322
21433
|
try {
|
|
21323
|
-
var
|
|
21324
|
-
if (
|
|
21434
|
+
var _this13 = this;
|
|
21435
|
+
if (_this13.player && _this13.player.video.readyState < 3) {
|
|
21325
21436
|
return Promise.resolve();
|
|
21326
21437
|
}
|
|
21327
|
-
|
|
21328
|
-
|
|
21329
|
-
if (
|
|
21330
|
-
|
|
21331
|
-
|
|
21438
|
+
_this13.player.off("playing", _this13.handlePlayerPlaying);
|
|
21439
|
+
_this13.player.off("timeupdate", _this13.handlePlayerPlaying);
|
|
21440
|
+
if (!_this13.player.video) {
|
|
21441
|
+
_this13.destroyFunc();
|
|
21442
|
+
return Promise.resolve();
|
|
21443
|
+
} else if (_this13.player.paused) {
|
|
21444
|
+
_this13.handleVideopause();
|
|
21445
|
+
return Promise.resolve();
|
|
21446
|
+
}
|
|
21447
|
+
if (_this13.core && _this13.core.getStats) {
|
|
21448
|
+
var _ref6 = _this13.core.getStats() || {}, fps = _ref6.fps;
|
|
21449
|
+
_this13.commonParams.fps = fps;
|
|
21332
21450
|
}
|
|
21333
|
-
return Promise.resolve(
|
|
21334
|
-
|
|
21335
|
-
var timer =
|
|
21336
|
-
|
|
21451
|
+
return Promise.resolve(_this13.reportPlaying(true)).then(function() {
|
|
21452
|
+
_this13.clearPlayingInterval();
|
|
21453
|
+
var timer = _this13.options.playingInterval || _this13.log.playing.play_time;
|
|
21454
|
+
_this13.intervalId = setInterval(function() {
|
|
21337
21455
|
try {
|
|
21338
|
-
var
|
|
21339
|
-
if (Math.abs(Date.now() -
|
|
21340
|
-
var
|
|
21341
|
-
if (!
|
|
21342
|
-
|
|
21456
|
+
var _temp8 = function() {
|
|
21457
|
+
if (Math.abs(Date.now() - _this13.log.playing.timestamp - timer) < 100 || Date.now() - _this13.log.playing.timestamp >= timer) {
|
|
21458
|
+
var _temp9 = function() {
|
|
21459
|
+
if (!_this13.player || !_this13.player.video) {
|
|
21460
|
+
_this13.destroyFunc();
|
|
21343
21461
|
} else {
|
|
21344
|
-
var
|
|
21345
|
-
if (
|
|
21346
|
-
|
|
21462
|
+
var _temp10 = function() {
|
|
21463
|
+
if (_this13.player.paused) {
|
|
21464
|
+
_this13.handleVideopause();
|
|
21347
21465
|
} else {
|
|
21348
|
-
return Promise.resolve(
|
|
21466
|
+
return Promise.resolve(_this13.reportPlaying()).then(function() {
|
|
21349
21467
|
});
|
|
21350
21468
|
}
|
|
21351
21469
|
}();
|
|
21352
|
-
if (
|
|
21353
|
-
return
|
|
21470
|
+
if (_temp10 && _temp10.then)
|
|
21471
|
+
return _temp10.then(function() {
|
|
21354
21472
|
});
|
|
21355
21473
|
}
|
|
21356
21474
|
}();
|
|
21357
|
-
if (
|
|
21358
|
-
return
|
|
21475
|
+
if (_temp9 && _temp9.then)
|
|
21476
|
+
return _temp9.then(function() {
|
|
21359
21477
|
});
|
|
21360
21478
|
}
|
|
21361
21479
|
}();
|
|
21362
|
-
return Promise.resolve(
|
|
21480
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function() {
|
|
21363
21481
|
}) : void 0);
|
|
21364
21482
|
} catch (e3) {
|
|
21365
21483
|
return Promise.reject(e3);
|
|
21366
21484
|
}
|
|
21367
21485
|
}, 1e3);
|
|
21368
|
-
|
|
21369
|
-
|
|
21370
|
-
if (!
|
|
21371
|
-
|
|
21486
|
+
_this13.clearStallTimer();
|
|
21487
|
+
_this13.handleVideoplaying();
|
|
21488
|
+
if (!_this13.started) {
|
|
21489
|
+
_this13.reportStartPlay();
|
|
21372
21490
|
}
|
|
21373
|
-
|
|
21491
|
+
_this13.saveBuffered();
|
|
21374
21492
|
});
|
|
21375
21493
|
} catch (e3) {
|
|
21376
21494
|
return Promise.reject(e3);
|
|
21377
21495
|
}
|
|
21378
21496
|
};
|
|
21379
21497
|
_proto2.handlePlayerReady = function handlePlayerReady() {
|
|
21380
|
-
var
|
|
21498
|
+
var _this14 = this;
|
|
21381
21499
|
this.log.start_play.start_play_time = getCurrentTime();
|
|
21382
21500
|
if (this.player.config.autoplay) {
|
|
21383
21501
|
this.reportStartPlay();
|
|
@@ -21388,14 +21506,16 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21388
21506
|
this.clearPlayResultTimer();
|
|
21389
21507
|
this.log.play_result.start = getCurrentTime();
|
|
21390
21508
|
this.playResultTimer = setTimeout(function() {
|
|
21391
|
-
if (
|
|
21509
|
+
if (_this14.log.play_result.timestamp >= _this14.log.play_result.start)
|
|
21392
21510
|
return;
|
|
21393
|
-
|
|
21394
|
-
|
|
21511
|
+
if (!_this14.player || _this14.player.paused || !_this14.player.video)
|
|
21512
|
+
return;
|
|
21513
|
+
_this14.log.play_result.is_threshold = 1;
|
|
21514
|
+
_this14.logmanager.push(_this14.log.play_result, true);
|
|
21395
21515
|
}, this.log.play_result.threshold);
|
|
21396
21516
|
};
|
|
21397
21517
|
_proto2.handlePlayerWaiting = function handlePlayerWaiting() {
|
|
21398
|
-
var
|
|
21518
|
+
var _this15 = this;
|
|
21399
21519
|
if (!!this.inWaitingStart || !this.log.first_frame.timestamp)
|
|
21400
21520
|
return;
|
|
21401
21521
|
this.log.stall.timestamp = this.inWaitingStart = this.log.stall.stall_start = getCurrentTime();
|
|
@@ -21407,11 +21527,13 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21407
21527
|
this.log.stall.play_current_time = this.player.currentTime;
|
|
21408
21528
|
this.log.stall_start.buffered = this.getBuffered();
|
|
21409
21529
|
this.log.stall.buffered = this.log.stall_start.buffered;
|
|
21410
|
-
|
|
21530
|
+
var _this$getPlayerDownlo = this.getPlayerDownloadSpeed(), speed = _this$getPlayerDownlo.speed, avgSpeed = _this$getPlayerDownlo.avgSpeed;
|
|
21531
|
+
this.log.stall.current_speed = speed;
|
|
21532
|
+
this.log.stall.avg_speed = avgSpeed;
|
|
21411
21533
|
Object.assign(this.log.stall_start, this.videoSize);
|
|
21412
21534
|
this.clearStallTimer();
|
|
21413
21535
|
this.stallStartTimer = setTimeout(function() {
|
|
21414
|
-
|
|
21536
|
+
_this15.logmanager.push(_this15.log.stall_start, true);
|
|
21415
21537
|
}, 205);
|
|
21416
21538
|
};
|
|
21417
21539
|
_proto2.handleVideoseeking = function handleVideoseeking() {
|
|
@@ -21482,37 +21604,36 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21482
21604
|
_proto2.handleVideoended = function handleVideoended() {
|
|
21483
21605
|
this.clearPlayingInterval();
|
|
21484
21606
|
this.clearStallTimer();
|
|
21485
|
-
Object.assign(this.log.playing,
|
|
21486
|
-
timestamp: getCurrentTime(),
|
|
21607
|
+
Object.assign(this.log.playing, {
|
|
21487
21608
|
is_last: 1
|
|
21488
|
-
}
|
|
21489
|
-
this.
|
|
21609
|
+
});
|
|
21610
|
+
this.reportPlaying();
|
|
21490
21611
|
};
|
|
21491
21612
|
_proto2.handleVideoerror = function handleVideoerror() {
|
|
21492
|
-
var
|
|
21613
|
+
var _this16 = this;
|
|
21493
21614
|
this.errorNumber = 1;
|
|
21494
21615
|
var error2 = this.player.video.error;
|
|
21495
21616
|
var firstframeFailed = function firstframeFailed2() {
|
|
21496
|
-
if (
|
|
21617
|
+
if (_this16.log.first_frame.first_frame_view === 0 && !_this16.log.first_frame_failed.code) {
|
|
21497
21618
|
if (error2) {
|
|
21498
|
-
|
|
21499
|
-
|
|
21500
|
-
if (
|
|
21501
|
-
|
|
21619
|
+
_this16.log.first_frame_failed.code = error2.code;
|
|
21620
|
+
_this16.log.first_frame_failed.msg = video_error[error2.code];
|
|
21621
|
+
if (_this16.log.first_frame_failed.timestamp !== void 0) {
|
|
21622
|
+
_this16.log.first_frame_failed.timestamp = getCurrentTime();
|
|
21502
21623
|
}
|
|
21503
|
-
|
|
21504
|
-
if (!
|
|
21505
|
-
|
|
21506
|
-
|
|
21507
|
-
|
|
21508
|
-
|
|
21624
|
+
_this16.logmanager.push(_this16.log.first_frame_failed, true);
|
|
21625
|
+
if (!_this16.log.play_result.is_threshold) {
|
|
21626
|
+
_this16.log.play_result.reason = video_error[error2.code] || "first frame failed";
|
|
21627
|
+
_this16.log.play_result.code = error2.code;
|
|
21628
|
+
_this16.clearPlayResultTimer();
|
|
21629
|
+
_this16.logmanager.push(_this16.log.play_result, true);
|
|
21509
21630
|
}
|
|
21510
21631
|
}
|
|
21511
21632
|
}
|
|
21512
|
-
if (
|
|
21513
|
-
|
|
21633
|
+
if (_this16.options.error_report_stop) {
|
|
21634
|
+
_this16.handleUserLeave();
|
|
21514
21635
|
} else {
|
|
21515
|
-
|
|
21636
|
+
_this16.updatePlayStopParams();
|
|
21516
21637
|
}
|
|
21517
21638
|
};
|
|
21518
21639
|
Object.assign(this.log.play_error, _objectSpread2(_objectSpread2({
|
|
@@ -21533,7 +21654,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21533
21654
|
this.player.once("timeupdate", this.handlePlayerPlaying);
|
|
21534
21655
|
};
|
|
21535
21656
|
_proto2.destroyFunc = function destroyFunc(no_report_stop) {
|
|
21536
|
-
var
|
|
21657
|
+
var _this17 = this;
|
|
21537
21658
|
if (this.destroyed) {
|
|
21538
21659
|
return;
|
|
21539
21660
|
}
|
|
@@ -21547,7 +21668,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21547
21668
|
window.removeEventListener("pagehide", this.handleUserLeave);
|
|
21548
21669
|
}
|
|
21549
21670
|
videoEvts.forEach(function(name) {
|
|
21550
|
-
|
|
21671
|
+
_this17.removeVideoEvt(name, _this17["handleVideo" + name + "Evt"]);
|
|
21551
21672
|
});
|
|
21552
21673
|
if (this.player) {
|
|
21553
21674
|
if (this.player._start) {
|
|
@@ -21571,26 +21692,26 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21571
21692
|
this.player.off("bufferappend", this.handleBufferAppend);
|
|
21572
21693
|
this.player.off("core_event", this.handleCoreEvent);
|
|
21573
21694
|
this.player.off("degrade", this.handleDegrade);
|
|
21574
|
-
this._player = null;
|
|
21575
21695
|
}
|
|
21576
21696
|
this.clearPlayingInterval();
|
|
21577
21697
|
this.clearStallTimer();
|
|
21578
21698
|
this.clearPlayResultTimer();
|
|
21579
21699
|
clearTimeout(this.collectDownloadSpeedTimer);
|
|
21700
|
+
this._player = null;
|
|
21580
21701
|
};
|
|
21581
21702
|
_proto2.handleUserLeave = function handleUserLeave() {
|
|
21582
21703
|
try {
|
|
21583
|
-
var
|
|
21584
|
-
if (
|
|
21704
|
+
var _this19 = this;
|
|
21705
|
+
if (_this19.destroyed || !_this19.started) {
|
|
21585
21706
|
return Promise.resolve();
|
|
21586
21707
|
}
|
|
21587
|
-
|
|
21588
|
-
return Promise.resolve(
|
|
21589
|
-
|
|
21590
|
-
|
|
21591
|
-
|
|
21592
|
-
clearTimeout(
|
|
21593
|
-
|
|
21708
|
+
_this19.destroyed = true;
|
|
21709
|
+
return Promise.resolve(_this19.updatePlayStopParams()).then(function() {
|
|
21710
|
+
_this19.reportPlayStop();
|
|
21711
|
+
_this19.clearPlayingInterval();
|
|
21712
|
+
_this19.clearStallTimer();
|
|
21713
|
+
clearTimeout(_this19.collectDownloadSpeedTimer);
|
|
21714
|
+
_this19.removeWindowListener();
|
|
21594
21715
|
});
|
|
21595
21716
|
} catch (e3) {
|
|
21596
21717
|
return Promise.reject(e3);
|
|
@@ -21621,94 +21742,94 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21621
21742
|
this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
|
|
21622
21743
|
this.saveBuffered();
|
|
21623
21744
|
}
|
|
21624
|
-
this.logmanager.push(this.log.play_stop
|
|
21745
|
+
this.logmanager.push(this.log.play_stop);
|
|
21625
21746
|
};
|
|
21626
21747
|
_proto2.reportFirstframe = function reportFirstframe() {
|
|
21627
21748
|
if (this.firstFrameViewed) {
|
|
21628
21749
|
return;
|
|
21629
21750
|
}
|
|
21630
21751
|
if (this.core && this.core.getStats) {
|
|
21631
|
-
var
|
|
21752
|
+
var _ref7 = this.core.getStats() || {}, fps = _ref7.fps;
|
|
21632
21753
|
this.commonParams.fps = fps;
|
|
21633
21754
|
}
|
|
21755
|
+
var transferCost = this.getTransferCost(true);
|
|
21634
21756
|
this.firstFrameViewed = true;
|
|
21635
21757
|
var currentTime = getCurrentTime();
|
|
21636
|
-
Object.assign(this.log.first_frame, _objectSpread2({
|
|
21758
|
+
Object.assign(this.log.first_frame, _objectSpread2(_objectSpread2({
|
|
21637
21759
|
first_frame_view: currentTime - this.log.start_play.start_play_time || currentTime,
|
|
21638
21760
|
timestamp: currentTime
|
|
21639
|
-
}, this.videoSize));
|
|
21761
|
+
}, transferCost), this.videoSize));
|
|
21640
21762
|
if (this.log.first_frame.ttfb_end) {
|
|
21641
21763
|
this.log.first_frame.ttdb = currentTime - this.log.first_frame.ttfb_end;
|
|
21642
21764
|
}
|
|
21643
|
-
this.logmanager.push(this.log.first_frame
|
|
21765
|
+
this.logmanager.push(this.log.first_frame);
|
|
21644
21766
|
this.clearPlayResultTimer();
|
|
21645
21767
|
this.log.play_result.result = 1;
|
|
21646
|
-
this.logmanager.push(this.log.play_result
|
|
21768
|
+
this.logmanager.push(this.log.play_result);
|
|
21647
21769
|
this.log.play_stop.is_stream_received = 1;
|
|
21648
21770
|
};
|
|
21649
21771
|
_proto2.updatePlayStopParams = function updatePlayStopParams() {
|
|
21650
21772
|
try {
|
|
21651
|
-
var
|
|
21652
|
-
var
|
|
21773
|
+
var _this21$core;
|
|
21774
|
+
var _temp13 = function _temp132() {
|
|
21653
21775
|
Object.assign(play_stop, _objectSpread2({
|
|
21654
21776
|
timestamp: endTime,
|
|
21655
21777
|
stop_time: endTime,
|
|
21656
|
-
duration:
|
|
21657
|
-
play_time:
|
|
21658
|
-
},
|
|
21659
|
-
if (
|
|
21660
|
-
play_stop.play_time_on_no_frame = play_stop.stop_time -
|
|
21778
|
+
duration: _this21.playedTime / 1e3,
|
|
21779
|
+
play_time: _this21.playedTime / 1e3
|
|
21780
|
+
}, _this21.videoSize));
|
|
21781
|
+
if (_this21.errorNumber === 0) {
|
|
21782
|
+
play_stop.play_time_on_no_frame = play_stop.stop_time - _this21.log.start_play.start_play_time;
|
|
21661
21783
|
}
|
|
21662
21784
|
};
|
|
21663
|
-
var
|
|
21664
|
-
var timing = getResourceTiming(
|
|
21785
|
+
var _this21 = this;
|
|
21786
|
+
var timing = getResourceTiming(_this21._url);
|
|
21665
21787
|
var endTime = getCurrentTime();
|
|
21666
|
-
|
|
21667
|
-
var play_stop =
|
|
21788
|
+
_this21.playedTime = endTime - _this21.log.start_play.start_play_time;
|
|
21789
|
+
var play_stop = _this21.log.play_stop;
|
|
21668
21790
|
Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
|
|
21669
21791
|
stall_time: 0
|
|
21670
21792
|
}));
|
|
21671
|
-
if (
|
|
21672
|
-
play_stop.stall_time += endTime -
|
|
21793
|
+
if (_this21.inWaitingStart && endTime - _this21.inWaitingStart > 200) {
|
|
21794
|
+
play_stop.stall_time += endTime - _this21.inWaitingStart;
|
|
21673
21795
|
}
|
|
21674
|
-
|
|
21796
|
+
_this21.inWaitingStart = 0;
|
|
21675
21797
|
Object.assign(play_stop, _objectSpread2({
|
|
21676
|
-
stall_time_per_100sec: play_stop.stall_time /
|
|
21798
|
+
stall_time_per_100sec: play_stop.stall_time / _this21.playedTime * 100,
|
|
21677
21799
|
// 计算百秒卡顿时长
|
|
21678
|
-
stall_count_per_100sec: play_stop.stall_count * 1e3 /
|
|
21800
|
+
stall_count_per_100sec: play_stop.stall_count * 1e3 / _this21.playedTime * 100
|
|
21679
21801
|
}, timing));
|
|
21680
|
-
if (
|
|
21681
|
-
|
|
21802
|
+
if (_this21.log.play_stop.stall_count_per_100sec === 0) {
|
|
21803
|
+
_this21.log.play_stop.stall_time_per_100sec = 0;
|
|
21682
21804
|
}
|
|
21683
|
-
if (
|
|
21805
|
+
if (_this21.log.play_stop.stall_time_per_100sec > 100 || _this21.log.play_stop.stall_time_per_100sec < 0) {
|
|
21684
21806
|
return Promise.resolve();
|
|
21685
21807
|
}
|
|
21686
|
-
if (
|
|
21687
|
-
Object.assign(
|
|
21688
|
-
timestamp: getCurrentTime(),
|
|
21808
|
+
if (_this21.log.playing.index) {
|
|
21809
|
+
Object.assign(_this21.log.playing, {
|
|
21689
21810
|
is_last: 1
|
|
21690
|
-
}
|
|
21691
|
-
|
|
21811
|
+
});
|
|
21812
|
+
_this21.reportPlaying();
|
|
21692
21813
|
} else {
|
|
21693
|
-
|
|
21694
|
-
|
|
21814
|
+
_this21.log.play_stop.error_code = _this21.log.play_error.code;
|
|
21815
|
+
_this21.log.play_stop.error_info = _this21.log.play_error.info;
|
|
21695
21816
|
}
|
|
21696
21817
|
endTime = getCurrentTime();
|
|
21697
|
-
if ((
|
|
21698
|
-
var
|
|
21699
|
-
Object.assign(
|
|
21818
|
+
if ((_this21$core = _this21.core) === null || _this21$core === void 0 ? void 0 : _this21$core.getStats) {
|
|
21819
|
+
var _ref8 = _this21.core.getStats() || {}, totalReceivedByte = _ref8.totalReceivedByte, totalReceivedCost = _ref8.totalReceivedCost;
|
|
21820
|
+
Object.assign(_this21.log.play_stop, {
|
|
21700
21821
|
totalReceivedByte,
|
|
21701
21822
|
totalReceivedCost,
|
|
21702
21823
|
totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
|
|
21703
21824
|
// bps
|
|
21704
21825
|
});
|
|
21705
21826
|
}
|
|
21706
|
-
var
|
|
21707
|
-
var
|
|
21708
|
-
if ((
|
|
21709
|
-
return Promise.resolve(
|
|
21710
|
-
var video =
|
|
21711
|
-
var
|
|
21827
|
+
var _temp14 = function() {
|
|
21828
|
+
var _this21$core2;
|
|
21829
|
+
if ((_this21$core2 = _this21.core) === null || _this21$core2 === void 0 ? void 0 : _this21$core2.getStatsSnapshoot) {
|
|
21830
|
+
return Promise.resolve(_this21.core.getStatsSnapshoot()).then(function(_ref9) {
|
|
21831
|
+
var video = _ref9.video;
|
|
21832
|
+
var _ref10 = video || {}, packetsLost = _ref10.packetsLost, packetsReceived = _ref10.packetsReceived;
|
|
21712
21833
|
Object.assign(play_stop, {
|
|
21713
21834
|
packetsLost,
|
|
21714
21835
|
packetsReceived,
|
|
@@ -21717,7 +21838,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
21717
21838
|
});
|
|
21718
21839
|
}
|
|
21719
21840
|
}();
|
|
21720
|
-
return Promise.resolve(
|
|
21841
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
|
|
21721
21842
|
} catch (e3) {
|
|
21722
21843
|
return Promise.reject(e3);
|
|
21723
21844
|
}
|
|
@@ -22514,8 +22635,6 @@ const generateSessionId = () => {
|
|
|
22514
22635
|
class Logger extends Plugin {
|
|
22515
22636
|
constructor() {
|
|
22516
22637
|
super(...arguments);
|
|
22517
|
-
__publicField(this, "_userId");
|
|
22518
|
-
__publicField(this, "_deviceId");
|
|
22519
22638
|
__publicField(this, "_liveLogger");
|
|
22520
22639
|
}
|
|
22521
22640
|
static get pluginName() {
|
|
@@ -22571,8 +22690,8 @@ class Logger extends Plugin {
|
|
|
22571
22690
|
});
|
|
22572
22691
|
q.start();
|
|
22573
22692
|
q.config({
|
|
22574
|
-
user_unique_id: this.
|
|
22575
|
-
device_id: this.
|
|
22693
|
+
user_unique_id: this.config.userId,
|
|
22694
|
+
device_id: this.config.deviceId
|
|
22576
22695
|
});
|
|
22577
22696
|
}
|
|
22578
22697
|
_start() {
|
|
@@ -22583,11 +22702,11 @@ class Logger extends Plugin {
|
|
|
22583
22702
|
aid: this.config.appId || 654925,
|
|
22584
22703
|
project_key: this.config.appId,
|
|
22585
22704
|
app_name: this.config.appName || this.config.appId,
|
|
22586
|
-
user_id: this.
|
|
22587
|
-
device_id: this.
|
|
22705
|
+
user_id: this.config.userId,
|
|
22706
|
+
device_id: this.config.deviceId,
|
|
22588
22707
|
error_report_stop: true,
|
|
22589
22708
|
ext: {
|
|
22590
|
-
veplayer_version: "2.7.
|
|
22709
|
+
veplayer_version: "2.7.1-rc.1",
|
|
22591
22710
|
flv_version: "3.0.21-rc.21",
|
|
22592
22711
|
hls_version: "3.0.21-rc.21",
|
|
22593
22712
|
rts_version: "0.2.1-alpha.14"
|