@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
|
@@ -323,6 +323,19 @@ function _objectSpread2(target) {
|
|
|
323
323
|
}
|
|
324
324
|
return target;
|
|
325
325
|
}
|
|
326
|
+
typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /* @__PURE__ */ Symbol("Symbol.iterator")) : "@@iterator";
|
|
327
|
+
typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /* @__PURE__ */ Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
|
|
328
|
+
function _catch(body, recover) {
|
|
329
|
+
try {
|
|
330
|
+
var result = body();
|
|
331
|
+
} catch (e3) {
|
|
332
|
+
return recover(e3);
|
|
333
|
+
}
|
|
334
|
+
if (result && result.then) {
|
|
335
|
+
return result.then(void 0, recover);
|
|
336
|
+
}
|
|
337
|
+
return result;
|
|
338
|
+
}
|
|
326
339
|
var device_id_key = "xgplayer_device_id";
|
|
327
340
|
var user_id_key = "xgplayer_user_id";
|
|
328
341
|
var getCookie = function getCookie2(key) {
|
|
@@ -526,17 +539,25 @@ function getPlayerCore(player) {
|
|
|
526
539
|
return player.plugins.hls;
|
|
527
540
|
} else if (player.plugins.rts) {
|
|
528
541
|
return player.plugins.rts;
|
|
529
|
-
} else if (player.plugins.
|
|
530
|
-
return player.plugins.
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
|
|
542
|
+
} else if (player.plugins.flvlive) {
|
|
543
|
+
return player.plugins.flvlive;
|
|
544
|
+
} else if (player.plugins.hlslive) {
|
|
545
|
+
return player.plugins.hlslive;
|
|
546
|
+
} else if (player.plugins.hlsvod) {
|
|
547
|
+
return player.plugins.hlsvod;
|
|
548
|
+
} else if (player.plugins.hlslivemobile) {
|
|
549
|
+
return player.plugins.hlslivemobile;
|
|
550
|
+
} else if (player.plugins.flvlivemobile) {
|
|
551
|
+
return player.plugins.flvlivemobile;
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
return player.newHls || player.newFlv || player.__core__ || player.flv;
|
|
534
555
|
}
|
|
535
556
|
function getDefaultOptions(options) {
|
|
536
557
|
return {
|
|
537
558
|
device_id: options.device_id || getDeviceID$1(),
|
|
538
559
|
user_id: options.user_id || getUserId$1(),
|
|
539
|
-
error_report_stop:
|
|
560
|
+
error_report_stop: typeof options.error_report_stop === "boolean" ? options.error_report_stop : true,
|
|
540
561
|
project_key: options.project_key || "live",
|
|
541
562
|
product_line: options.product_line || "live",
|
|
542
563
|
onReport: options.onReport || function() {
|
|
@@ -759,9 +780,8 @@ function getCommonLog(options) {
|
|
|
759
780
|
live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
|
|
760
781
|
player_sdk_version: player.version,
|
|
761
782
|
// eslint-disable-next-line no-undef
|
|
762
|
-
logger_version: "1.1.0-alpha.
|
|
783
|
+
logger_version: "1.1.0-alpha.17",
|
|
763
784
|
// 由rollup 在编译时注入
|
|
764
|
-
report_version: "5",
|
|
765
785
|
product_line: options.product_line,
|
|
766
786
|
user_id: options.user_id,
|
|
767
787
|
device_id: options.device_id,
|
|
@@ -770,6 +790,7 @@ function getCommonLog(options) {
|
|
|
770
790
|
cdn_ip: options.cdn_ip,
|
|
771
791
|
is_wasm: +(!!mediaType && mediaType !== "video"),
|
|
772
792
|
review_is_live: player.config.isLive ? 2 : 1,
|
|
793
|
+
isSupportedH265: isCodecSupport("hev1.1.6.L93.B0,mp4a.40.2"),
|
|
773
794
|
aid: options.aid,
|
|
774
795
|
live_id: options.live_id || options.aid + "-" + options.user_id + "-" + Date.now(),
|
|
775
796
|
is_preview: options.is_preview ? 1 : 0,
|
|
@@ -895,6 +916,7 @@ var Manage = /* @__PURE__ */ function() {
|
|
|
895
916
|
log.cpu_core_number = cpu_core_number;
|
|
896
917
|
log.memory_usage = memory_usage;
|
|
897
918
|
log.network_downlink = network_downlink;
|
|
919
|
+
log.muted = +this._player.muted;
|
|
898
920
|
Object.assign(log, _objectSpread2({}, this.videoSize));
|
|
899
921
|
this.send(log);
|
|
900
922
|
};
|
|
@@ -925,14 +947,29 @@ var getNetStat = function getNetStat2() {
|
|
|
925
947
|
}
|
|
926
948
|
return "unknown";
|
|
927
949
|
};
|
|
928
|
-
var videoEvts = [
|
|
950
|
+
var videoEvts = [
|
|
951
|
+
"play",
|
|
952
|
+
"playing",
|
|
953
|
+
"pause",
|
|
954
|
+
"ended",
|
|
955
|
+
// 'error',
|
|
956
|
+
"seeking",
|
|
957
|
+
"seeked",
|
|
958
|
+
"timeupdate",
|
|
959
|
+
"waiting",
|
|
960
|
+
"canplay",
|
|
961
|
+
"canplaythrough",
|
|
962
|
+
"durationchange",
|
|
963
|
+
"ratechange",
|
|
964
|
+
"volumechange",
|
|
965
|
+
"loadeddata"
|
|
966
|
+
];
|
|
929
967
|
var LoggerControl = /* @__PURE__ */ function() {
|
|
930
968
|
function LoggerControl2(options) {
|
|
931
969
|
this.options = options;
|
|
932
970
|
this.logger = new XgLiveLogger(options);
|
|
933
971
|
this.restart = this.restart.bind(this);
|
|
934
972
|
this.bindUrlChange();
|
|
935
|
-
sniffer.browser.includes("Chrome");
|
|
936
973
|
}
|
|
937
974
|
var _proto = LoggerControl2.prototype;
|
|
938
975
|
_proto.restart = function restart(report_stop) {
|
|
@@ -956,6 +993,9 @@ var LoggerControl = /* @__PURE__ */ function() {
|
|
|
956
993
|
this.logger.updateExt(ext);
|
|
957
994
|
}
|
|
958
995
|
};
|
|
996
|
+
_proto.sendLog = function sendLog(log) {
|
|
997
|
+
this.logger.sendLog(log);
|
|
998
|
+
};
|
|
959
999
|
_proto.destroy = function destroy(report_stop) {
|
|
960
1000
|
this.logger.destroy(report_stop);
|
|
961
1001
|
this.logger = null;
|
|
@@ -1017,6 +1057,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1017
1057
|
this.completed = false;
|
|
1018
1058
|
this.firstFrameViewed = false;
|
|
1019
1059
|
this.cacheRtcStats = {};
|
|
1060
|
+
this.cachePlaying = {};
|
|
1020
1061
|
}
|
|
1021
1062
|
var _proto2 = XgLiveLogger2.prototype;
|
|
1022
1063
|
_proto2.setNTP = function setNTP(ntp) {
|
|
@@ -1106,6 +1147,14 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1106
1147
|
});
|
|
1107
1148
|
}
|
|
1108
1149
|
};
|
|
1150
|
+
_proto2.sendLog = function sendLog(log) {
|
|
1151
|
+
for (var commonKey in this.commonParams) {
|
|
1152
|
+
if (log[commonKey] === void 0) {
|
|
1153
|
+
log[commonKey] = this["_" + commonKey] || this.commonParams[commonKey];
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
this.logmanager.push(log);
|
|
1157
|
+
};
|
|
1109
1158
|
_proto2.updateExt = function updateExt(ext) {
|
|
1110
1159
|
for (var logKey in this.log) {
|
|
1111
1160
|
for (var extKey in ext) {
|
|
@@ -1244,9 +1293,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1244
1293
|
};
|
|
1245
1294
|
};
|
|
1246
1295
|
_proto2.handleTTFB = function handleTTFB(params) {
|
|
1247
|
-
var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed;
|
|
1296
|
+
var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed, responseUrl = _ref.responseUrl, url = _ref.url;
|
|
1248
1297
|
this.log.first_frame.ttfb = elapsed || -1;
|
|
1249
1298
|
this.log.first_frame.ttfb_end = end || 0;
|
|
1299
|
+
this.log.first_frame.is_redirect = +(url !== responseUrl);
|
|
1300
|
+
this.log.play_result.is_redirect = this.log.first_frame.is_redirect;
|
|
1250
1301
|
};
|
|
1251
1302
|
_proto2.handleUrlChange = function handleUrlChange(url) {
|
|
1252
1303
|
this.logmanager.push(Object.assign(this.log.play_url_change, {
|
|
@@ -1298,11 +1349,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1298
1349
|
this.clearPlayResultTimer();
|
|
1299
1350
|
this.log.play_result.reason = err.message || "first frame failed";
|
|
1300
1351
|
this.log.play_result.code = this.log.play_error.code;
|
|
1301
|
-
this.logmanager.push(this.log.play_result
|
|
1352
|
+
this.logmanager.push(this.log.play_result);
|
|
1302
1353
|
}
|
|
1303
1354
|
}
|
|
1304
1355
|
if (this.options.error_report_stop) {
|
|
1305
|
-
this.
|
|
1356
|
+
this.destroy(true);
|
|
1306
1357
|
} else {
|
|
1307
1358
|
this.updatePlayStopParams();
|
|
1308
1359
|
}
|
|
@@ -1326,22 +1377,36 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1326
1377
|
this.logmanager.push(play_stream_loaded);
|
|
1327
1378
|
};
|
|
1328
1379
|
_proto2.handleSEIParsed = function handleSEIParsed(sei) {
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
var
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1380
|
+
try {
|
|
1381
|
+
var _this5 = this;
|
|
1382
|
+
var _this5$log = _this5.log, playing = _this5$log.playing, first_frame = _this5$log.first_frame;
|
|
1383
|
+
var _temp3 = function() {
|
|
1384
|
+
if (sei.code === 100) {
|
|
1385
|
+
var seiString = Utf8ArrayToStr(sei.content);
|
|
1386
|
+
seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
|
|
1387
|
+
var _temp4 = _catch(function() {
|
|
1388
|
+
var seiContent = JSON.parse(seiString);
|
|
1389
|
+
return Promise.resolve(_this5.getPlayerBuffer()).then(function(bufferTime) {
|
|
1390
|
+
var seiDelay = bufferTime + _this5.ntpTime - seiContent.ts;
|
|
1391
|
+
playing.sei_delay = seiDelay;
|
|
1392
|
+
playing.sei_source = seiContent.source;
|
|
1393
|
+
playing.ntp_sync = _this5.options.ntp ? 1 : 0;
|
|
1394
|
+
playing.ntp_delta = _this5.ntp_delta;
|
|
1395
|
+
first_frame.first_sei_delay = seiDelay;
|
|
1396
|
+
first_frame.ntp_sync = _this5.options.ntp ? 1 : 0;
|
|
1397
|
+
first_frame.ntp_delta = _this5.ntp_delta;
|
|
1398
|
+
});
|
|
1399
|
+
}, function() {
|
|
1400
|
+
});
|
|
1401
|
+
if (_temp4 && _temp4.then)
|
|
1402
|
+
return _temp4.then(function() {
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
}();
|
|
1406
|
+
return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function() {
|
|
1407
|
+
}) : void 0);
|
|
1408
|
+
} catch (e3) {
|
|
1409
|
+
return Promise.reject(e3);
|
|
1345
1410
|
}
|
|
1346
1411
|
};
|
|
1347
1412
|
_proto2.handleMetaDataLoaded = function handleMetaDataLoaded(type, meta) {
|
|
@@ -1371,7 +1436,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1371
1436
|
_proto2.handleAVUnsync = function handleAVUnsync(unsyncInfo) {
|
|
1372
1437
|
Object.assign(this.log.play_av_unsync, unsyncInfo || {});
|
|
1373
1438
|
this.log.play_av_unsync.timestamp = getCurrentTime();
|
|
1374
|
-
this.logmanager.push(this.log.play_av_unsync
|
|
1439
|
+
this.logmanager.push(this.log.play_av_unsync);
|
|
1375
1440
|
};
|
|
1376
1441
|
_proto2.handleStreamException = function handleStreamException(info) {
|
|
1377
1442
|
this.logmanager.push(Object.assign({}, this.log.stream_exception, info));
|
|
@@ -1391,27 +1456,58 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1391
1456
|
}
|
|
1392
1457
|
};
|
|
1393
1458
|
_proto2.getPlayerBuffer = function getPlayerBuffer() {
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1459
|
+
try {
|
|
1460
|
+
var _this7 = this;
|
|
1461
|
+
return Promise.resolve(_this7.getRtcStats({
|
|
1462
|
+
onlyJb: true
|
|
1463
|
+
})).then(function(rtc_stats) {
|
|
1464
|
+
if (rtc_stats.video_jb_delay !== void 0) {
|
|
1465
|
+
return rtc_stats.video_jb_delay;
|
|
1466
|
+
}
|
|
1467
|
+
var buffered = _this7.player.video.buffered;
|
|
1468
|
+
if (buffered) {
|
|
1469
|
+
var bufferIdx = Math.max(0, buffered.length - 1);
|
|
1470
|
+
try {
|
|
1471
|
+
var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - _this7.player.video.currentTime) * 1e3);
|
|
1472
|
+
_this7.log.playing.audio_buffer_time = _this7.log.playing.video_buffer_time = bufferedTime;
|
|
1473
|
+
return bufferedTime;
|
|
1474
|
+
} catch (e3) {
|
|
1475
|
+
return 0;
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1479
|
+
} catch (e3) {
|
|
1480
|
+
return Promise.reject(e3);
|
|
1404
1481
|
}
|
|
1405
1482
|
};
|
|
1483
|
+
_proto2.getTransferCost = function getTransferCost(isFirstFrame) {
|
|
1484
|
+
var _this$core;
|
|
1485
|
+
if (!((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.transferCost)) {
|
|
1486
|
+
return {};
|
|
1487
|
+
}
|
|
1488
|
+
if (isFirstFrame)
|
|
1489
|
+
return this.core.transferCost;
|
|
1490
|
+
var _this$core$transferCo = this.core.transferCost, demuxCost = _this$core$transferCo.demuxCost, remuxCost = _this$core$transferCo.remuxCost, appendCost = _this$core$transferCo.appendCost;
|
|
1491
|
+
var transferCost = {
|
|
1492
|
+
demuxCost: demuxCost - this.cachePlaying.demuxCost,
|
|
1493
|
+
remuxCost: remuxCost - this.cachePlaying.remuxCost,
|
|
1494
|
+
appendCost: appendCost - this.cachePlaying.appendCost
|
|
1495
|
+
};
|
|
1496
|
+
Object.assign(this.cachePlaying, this.core.transferCost);
|
|
1497
|
+
return transferCost;
|
|
1498
|
+
};
|
|
1406
1499
|
_proto2.getPlayerDownloadSpeed = function getPlayerDownloadSpeed() {
|
|
1407
1500
|
if (this.core && this.core.core) {
|
|
1408
1501
|
if (typeof this.core.core.speedInfo === "function") {
|
|
1409
|
-
return this.core.core.speedInfo().speed;
|
|
1502
|
+
return this.core.core.speedInfo().speed || {};
|
|
1410
1503
|
}
|
|
1411
1504
|
}
|
|
1505
|
+
return {};
|
|
1412
1506
|
};
|
|
1413
1507
|
_proto2.getPlayerQuality = function getPlayerQuality() {
|
|
1414
1508
|
var video = this.player.video;
|
|
1509
|
+
if (!video)
|
|
1510
|
+
return;
|
|
1415
1511
|
if (video.getVideoPlaybackQuality) {
|
|
1416
1512
|
var quality = video.getVideoPlaybackQuality();
|
|
1417
1513
|
this.log.playing.drop_count = quality.droppedVideoFrames - this.tempDroppedFrameCount;
|
|
@@ -1425,10 +1521,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1425
1521
|
this.tempDroppedFrameCount = droppedVideoFrames;
|
|
1426
1522
|
}
|
|
1427
1523
|
};
|
|
1428
|
-
_proto2.getRtcStats = function getRtcStats(
|
|
1524
|
+
_proto2.getRtcStats = function getRtcStats(_ref2) {
|
|
1525
|
+
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;
|
|
1429
1526
|
try {
|
|
1430
|
-
var
|
|
1431
|
-
var rtm =
|
|
1527
|
+
var _this9 = this;
|
|
1528
|
+
var rtm = _this9.player.plugins.rts || _this9.player.plugins.rtm;
|
|
1432
1529
|
var pc = rtm && rtm.pc;
|
|
1433
1530
|
var rtc_stats = {};
|
|
1434
1531
|
if (!pc)
|
|
@@ -1439,53 +1536,56 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1439
1536
|
switch (type) {
|
|
1440
1537
|
case "inbound-rtp":
|
|
1441
1538
|
if (mediaType === "audio") {
|
|
1442
|
-
rtc_stats.audio_bytes_received = bytesReceived - (
|
|
1443
|
-
|
|
1444
|
-
rtc_stats.audio_packets_lost = packetsLost - (
|
|
1445
|
-
rtc_stats.audio_packets_received = packetsReceived - (
|
|
1446
|
-
|
|
1447
|
-
|
|
1539
|
+
rtc_stats.audio_bytes_received = bytesReceived - (_this9.cacheRtcStats.audioBytesReceived || 0);
|
|
1540
|
+
_this9.cacheRtcStats.audioBytesReceived = bytesReceived;
|
|
1541
|
+
rtc_stats.audio_packets_lost = packetsLost - (_this9.cacheRtcStats.audioPacketsLost || 0);
|
|
1542
|
+
rtc_stats.audio_packets_received = packetsReceived - (_this9.cacheRtcStats.audioPacketsReceived || 0);
|
|
1543
|
+
_this9.cacheRtcStats.audioPacketsLost = packetsLost;
|
|
1544
|
+
_this9.cacheRtcStats.audioPacketsReceived = packetsReceived;
|
|
1448
1545
|
rtc_stats.audio_level = audioLevel;
|
|
1449
1546
|
rtc_stats.concealment_event = concealmentEvents;
|
|
1450
1547
|
rtc_stats.audio_fraction_lost = rtc_stats.audio_packets_lost / rtc_stats.audio_packets_received;
|
|
1451
|
-
if (
|
|
1452
|
-
rtc_stats.audio_rec_sample_rate = (totalSamplesReceived -
|
|
1548
|
+
if (_this9.cacheRtcStats.totalSamplesReceived !== void 0) {
|
|
1549
|
+
rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this9.cacheRtcStats.totalSamplesReceived) / duration;
|
|
1453
1550
|
}
|
|
1454
|
-
|
|
1551
|
+
_this9.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
|
|
1455
1552
|
rtc_stats.concealed_samples = concealedSamples;
|
|
1456
1553
|
rtc_stats.total_samples_received = totalSamplesReceived;
|
|
1457
1554
|
} else {
|
|
1555
|
+
rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
|
|
1556
|
+
if (onlyJb) {
|
|
1557
|
+
return rtc_stats;
|
|
1558
|
+
}
|
|
1458
1559
|
rtc_stats.frames_dropped = framesDropped;
|
|
1459
1560
|
rtc_stats.iframes_decoded = keyFramesDecoded;
|
|
1460
|
-
rtc_stats.video_bytes_received = bytesReceived - (
|
|
1461
|
-
|
|
1561
|
+
rtc_stats.video_bytes_received = bytesReceived - (_this9.cacheRtcStats.videoBytesReceived || 0);
|
|
1562
|
+
_this9.cacheRtcStats.videoBytesReceived = bytesReceived;
|
|
1462
1563
|
rtc_stats.video_dec_time = totalDecodeTime;
|
|
1463
1564
|
rtc_stats.video_decoded_delay_ms = rtc_stats.video_dec_elapse / framesDecoded;
|
|
1464
1565
|
rtc_stats.video_frame_height = frameHeight;
|
|
1465
1566
|
rtc_stats.video_frame_width = frameWidth;
|
|
1466
|
-
if (
|
|
1467
|
-
rtc_stats.video_decode_framerate = (framesDecoded -
|
|
1567
|
+
if (_this9.cacheRtcStats.framesDecoded !== void 0) {
|
|
1568
|
+
rtc_stats.video_decode_framerate = (framesDecoded - _this9.cacheRtcStats.framesDecoded) / duration;
|
|
1468
1569
|
}
|
|
1469
|
-
|
|
1470
|
-
if (
|
|
1471
|
-
rtc_stats.video_recv_framerate = (framesReceived -
|
|
1570
|
+
_this9.cacheRtcStats.framesDecoded = framesDecoded;
|
|
1571
|
+
if (_this9.cacheRtcStats.framesReceived !== void 0) {
|
|
1572
|
+
rtc_stats.video_recv_framerate = (framesReceived - _this9.cacheRtcStats.framesReceived) / duration;
|
|
1472
1573
|
}
|
|
1473
|
-
if (
|
|
1474
|
-
rtc_stats.freeze_count = freezeCount -
|
|
1475
|
-
rtc_stats.freeze_duration = totalFreezesDuration -
|
|
1574
|
+
if (_this9.cacheRtcStats.freezeCount !== void 0) {
|
|
1575
|
+
rtc_stats.freeze_count = freezeCount - _this9.cacheRtcStats.freezeCount;
|
|
1576
|
+
rtc_stats.freeze_duration = totalFreezesDuration - _this9.cacheRtcStats.totalFreezesDuration;
|
|
1476
1577
|
}
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1578
|
+
_this9.cacheRtcStats.freezeCount = freezeCount;
|
|
1579
|
+
_this9.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
|
|
1580
|
+
_this9.cacheRtcStats.framesReceived = framesReceived;
|
|
1480
1581
|
rtc_stats.total_pauses_duration = totalPausesDuration;
|
|
1481
|
-
rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
|
|
1482
1582
|
rtc_stats.video_jitter = jitter * 1e3;
|
|
1483
1583
|
rtc_stats.video_nack_count = nackCount;
|
|
1484
|
-
rtc_stats.video_packets_lost = packetsLost - (
|
|
1485
|
-
rtc_stats.video_packets_received = packetsReceived - (
|
|
1584
|
+
rtc_stats.video_packets_lost = packetsLost - (_this9.cacheRtcStats.videoPacketsLost || 0);
|
|
1585
|
+
rtc_stats.video_packets_received = packetsReceived - (_this9.cacheRtcStats.videoPacketsReceived || 0);
|
|
1486
1586
|
rtc_stats.video_fraction_lost = rtc_stats.video_packets_lost / rtc_stats.video_packets_received;
|
|
1487
|
-
|
|
1488
|
-
|
|
1587
|
+
_this9.cacheRtcStats.videoPacketsLost = packetsLost;
|
|
1588
|
+
_this9.cacheRtcStats.videoPacketsReceived = packetsReceived;
|
|
1489
1589
|
rtc_stats.video_pli_count = pliCount;
|
|
1490
1590
|
rtc_stats.decoder_name = decoderImplementation;
|
|
1491
1591
|
}
|
|
@@ -1509,13 +1609,12 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1509
1609
|
rtc_stats.audio_codec = mediaType;
|
|
1510
1610
|
}
|
|
1511
1611
|
}
|
|
1512
|
-
rtc_stats.total_delay = rtc_stats.e2e_delay_ms + (rtc_stats.video_decoded_delay_ms || 0) + (rtc_stats.video_jb_delay || 0);
|
|
1513
1612
|
});
|
|
1514
|
-
Object.assign(
|
|
1613
|
+
Object.assign(_this9.log.playing, {
|
|
1515
1614
|
video_download_size: rtc_stats.video_bytes_received,
|
|
1516
1615
|
decode_fps: rtc_stats.video_decode_framerate,
|
|
1517
|
-
sei_delay: rtc_stats.total_delay,
|
|
1518
|
-
sei_network_delay: rtc_stats.e2e_delay_ms,
|
|
1616
|
+
// sei_delay: rtc_stats.total_delay,
|
|
1617
|
+
// sei_network_delay: rtc_stats.e2e_delay_ms,
|
|
1519
1618
|
width: rtc_stats.video_frame_width,
|
|
1520
1619
|
height: rtc_stats.video_frame_height,
|
|
1521
1620
|
current_speed: (rtc_stats.audio_bytes_received + rtc_stats.video_bytes_received) / duration
|
|
@@ -1528,31 +1627,34 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1528
1627
|
};
|
|
1529
1628
|
_proto2.reportPlaying = function reportPlaying(first) {
|
|
1530
1629
|
try {
|
|
1531
|
-
var
|
|
1532
|
-
if (
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1630
|
+
var _this11 = this;
|
|
1631
|
+
if (_this11.commonParams.is_wasm) {
|
|
1632
|
+
_this11.commonParams.fps = _this11.player.video.fps;
|
|
1633
|
+
_this11.log.playing.render_fps = _this11.player.video.fps;
|
|
1634
|
+
_this11.log.playing.decode_fps = _this11.player.video.decodeFps;
|
|
1536
1635
|
}
|
|
1537
|
-
|
|
1538
|
-
var lastPlayingTime =
|
|
1636
|
+
_this11.log.playing.index++;
|
|
1637
|
+
var lastPlayingTime = _this11.log.playing.timestamp;
|
|
1539
1638
|
var stallTime;
|
|
1540
|
-
if (
|
|
1541
|
-
stallTime = Math.min(
|
|
1639
|
+
if (_this11.inWaitingStart && _this11.inWaitingStart < getCurrentTime()) {
|
|
1640
|
+
stallTime = Math.min(_this11.options.playingInterval || _this11.log.playing.play_time, getCurrentTime() - Math.max(_this11.inWaitingStart, lastPlayingTime));
|
|
1542
1641
|
}
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1642
|
+
_this11.getPlayerQuality();
|
|
1643
|
+
_this11.getPlayerBuffer();
|
|
1644
|
+
var transferCost = _this11.getTransferCost(false);
|
|
1645
|
+
if (!_this11.options.downloadSpeedInterval) {
|
|
1646
|
+
var _this11$getPlayerDown = _this11.getPlayerDownloadSpeed(), speed = _this11$getPlayerDown.speed, avgSpeed = _this11$getPlayerDown.avgSpeed;
|
|
1647
|
+
_this11.log.playing.current_speed = speed;
|
|
1648
|
+
_this11.log.playing.avg_speed = avgSpeed;
|
|
1547
1649
|
}
|
|
1548
1650
|
var now2 = getCurrentTime();
|
|
1549
1651
|
var playedTime = now2 - lastPlayingTime;
|
|
1550
|
-
var stall_time = (stallTime > 200 ? stallTime : 0) +
|
|
1551
|
-
var stall_count = (stallTime > 200 ? 1 : 0) +
|
|
1552
|
-
if (
|
|
1553
|
-
|
|
1652
|
+
var stall_time = (stallTime > 200 ? stallTime : 0) + _this11.log.playing.stall_time;
|
|
1653
|
+
var stall_count = (stallTime > 200 ? 1 : 0) + _this11.log.playing.stall_count;
|
|
1654
|
+
if (_this11.options.aggregationDowngradeStallTime) {
|
|
1655
|
+
_this11.log.playing.aggregation_downgrade_stall = (stallTime > _this11.options.aggregationDowngradeStallTime ? stallTime : 0) + (_this11.log.playing.aggregation_downgrade_stall || 0);
|
|
1554
1656
|
}
|
|
1555
|
-
Object.assign(
|
|
1657
|
+
Object.assign(_this11.log.playing, _objectSpread2(_objectSpread2({
|
|
1556
1658
|
timestamp: now2,
|
|
1557
1659
|
// 60s内存在多次触发playing
|
|
1558
1660
|
stop_time: now2,
|
|
@@ -1564,37 +1666,41 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1564
1666
|
stall_count,
|
|
1565
1667
|
// playing前会有一次卡顿现处于waiting状态
|
|
1566
1668
|
stall_time,
|
|
1567
|
-
play_current_time:
|
|
1568
|
-
},
|
|
1569
|
-
return Promise.resolve(
|
|
1669
|
+
play_current_time: _this11.player.currentTime
|
|
1670
|
+
}, transferCost), _this11.videoSize));
|
|
1671
|
+
return Promise.resolve(_this11.getRtcStats({
|
|
1672
|
+
duration: playedTime,
|
|
1673
|
+
first,
|
|
1674
|
+
onlyJb: false
|
|
1675
|
+
})).then(function(stats) {
|
|
1570
1676
|
var flvStats = {};
|
|
1571
|
-
if (
|
|
1572
|
-
if (
|
|
1573
|
-
var
|
|
1677
|
+
if (_this11.core) {
|
|
1678
|
+
if (_this11.core.getStats) {
|
|
1679
|
+
var _ref3 = _this11.core.getStats() || {}, bitrate = _ref3.bitrate, _avgSpeed = _ref3.avgSpeed;
|
|
1574
1680
|
Object.assign(flvStats, {
|
|
1575
1681
|
bitrate,
|
|
1576
|
-
avg_speed:
|
|
1577
|
-
rate:
|
|
1682
|
+
avg_speed: _avgSpeed,
|
|
1683
|
+
rate: _avgSpeed / bitrate
|
|
1578
1684
|
});
|
|
1579
1685
|
}
|
|
1580
|
-
if (
|
|
1581
|
-
var
|
|
1582
|
-
var
|
|
1583
|
-
var
|
|
1686
|
+
if (_this11.core.getNetWorkInfo) {
|
|
1687
|
+
var _this11$core$core;
|
|
1688
|
+
var _ref4 = _this11.core.getNetWorkInfo() || {}, lostRate = _ref4.lostRate;
|
|
1689
|
+
var _ref5 = ((_this11$core$core = _this11.core.core) === null || _this11$core$core === void 0 ? void 0 : _this11$core$core._opts) || {}, networkEvaluateInterval = _ref5.networkEvaluateInterval;
|
|
1584
1690
|
Object.assign(flvStats, {
|
|
1585
1691
|
lostRate,
|
|
1586
1692
|
networkEvaluateInterval
|
|
1587
1693
|
});
|
|
1588
1694
|
}
|
|
1589
1695
|
}
|
|
1590
|
-
|
|
1696
|
+
_this11.logmanager.push(Object.assign({}, _this11.log.playing, _objectSpread2(_objectSpread2({
|
|
1591
1697
|
play_time: first ? 0 : playedTime
|
|
1592
1698
|
}, stats), flvStats)), true);
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
if (
|
|
1597
|
-
|
|
1699
|
+
_this11.log.playing.download_speed_array = [];
|
|
1700
|
+
_this11.log.playing.stall_time = 0;
|
|
1701
|
+
_this11.log.playing.stall_count = 0;
|
|
1702
|
+
if (_this11.options.aggregationDowngradeStallTime) {
|
|
1703
|
+
_this11.log.playing.aggregation_downgrade_stall = 0;
|
|
1598
1704
|
}
|
|
1599
1705
|
});
|
|
1600
1706
|
} catch (e3) {
|
|
@@ -1603,64 +1709,71 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1603
1709
|
};
|
|
1604
1710
|
_proto2.handlePlayerPlaying = function handlePlayerPlaying() {
|
|
1605
1711
|
try {
|
|
1606
|
-
var
|
|
1607
|
-
if (
|
|
1712
|
+
var _this13 = this;
|
|
1713
|
+
if (_this13.player && _this13.player.video.readyState < 3) {
|
|
1608
1714
|
return Promise.resolve();
|
|
1609
1715
|
}
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
if (
|
|
1613
|
-
|
|
1614
|
-
|
|
1716
|
+
_this13.player.off("playing", _this13.handlePlayerPlaying);
|
|
1717
|
+
_this13.player.off("timeupdate", _this13.handlePlayerPlaying);
|
|
1718
|
+
if (!_this13.player.video) {
|
|
1719
|
+
_this13.destroyFunc();
|
|
1720
|
+
return Promise.resolve();
|
|
1721
|
+
} else if (_this13.player.paused) {
|
|
1722
|
+
_this13.handleVideopause();
|
|
1723
|
+
return Promise.resolve();
|
|
1615
1724
|
}
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1725
|
+
if (_this13.core && _this13.core.getStats) {
|
|
1726
|
+
var _ref6 = _this13.core.getStats() || {}, fps = _ref6.fps;
|
|
1727
|
+
_this13.commonParams.fps = fps;
|
|
1728
|
+
}
|
|
1729
|
+
return Promise.resolve(_this13.reportPlaying(true)).then(function() {
|
|
1730
|
+
_this13.clearPlayingInterval();
|
|
1731
|
+
var timer = _this13.options.playingInterval || _this13.log.playing.play_time;
|
|
1732
|
+
_this13.intervalId = setInterval(function() {
|
|
1620
1733
|
try {
|
|
1621
|
-
var
|
|
1622
|
-
if (Math.abs(Date.now() -
|
|
1623
|
-
var
|
|
1624
|
-
if (!
|
|
1625
|
-
|
|
1734
|
+
var _temp8 = function() {
|
|
1735
|
+
if (Math.abs(Date.now() - _this13.log.playing.timestamp - timer) < 100 || Date.now() - _this13.log.playing.timestamp >= timer) {
|
|
1736
|
+
var _temp9 = function() {
|
|
1737
|
+
if (!_this13.player || !_this13.player.video) {
|
|
1738
|
+
_this13.destroyFunc();
|
|
1626
1739
|
} else {
|
|
1627
|
-
var
|
|
1628
|
-
if (
|
|
1629
|
-
|
|
1740
|
+
var _temp10 = function() {
|
|
1741
|
+
if (_this13.player.paused) {
|
|
1742
|
+
_this13.handleVideopause();
|
|
1630
1743
|
} else {
|
|
1631
|
-
return Promise.resolve(
|
|
1744
|
+
return Promise.resolve(_this13.reportPlaying()).then(function() {
|
|
1632
1745
|
});
|
|
1633
1746
|
}
|
|
1634
1747
|
}();
|
|
1635
|
-
if (
|
|
1636
|
-
return
|
|
1748
|
+
if (_temp10 && _temp10.then)
|
|
1749
|
+
return _temp10.then(function() {
|
|
1637
1750
|
});
|
|
1638
1751
|
}
|
|
1639
1752
|
}();
|
|
1640
|
-
if (
|
|
1641
|
-
return
|
|
1753
|
+
if (_temp9 && _temp9.then)
|
|
1754
|
+
return _temp9.then(function() {
|
|
1642
1755
|
});
|
|
1643
1756
|
}
|
|
1644
1757
|
}();
|
|
1645
|
-
return Promise.resolve(
|
|
1758
|
+
return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function() {
|
|
1646
1759
|
}) : void 0);
|
|
1647
1760
|
} catch (e3) {
|
|
1648
1761
|
return Promise.reject(e3);
|
|
1649
1762
|
}
|
|
1650
1763
|
}, 1e3);
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
if (!
|
|
1654
|
-
|
|
1764
|
+
_this13.clearStallTimer();
|
|
1765
|
+
_this13.handleVideoplaying();
|
|
1766
|
+
if (!_this13.started) {
|
|
1767
|
+
_this13.reportStartPlay();
|
|
1655
1768
|
}
|
|
1656
|
-
|
|
1769
|
+
_this13.saveBuffered();
|
|
1657
1770
|
});
|
|
1658
1771
|
} catch (e3) {
|
|
1659
1772
|
return Promise.reject(e3);
|
|
1660
1773
|
}
|
|
1661
1774
|
};
|
|
1662
1775
|
_proto2.handlePlayerReady = function handlePlayerReady() {
|
|
1663
|
-
var
|
|
1776
|
+
var _this14 = this;
|
|
1664
1777
|
this.log.start_play.start_play_time = getCurrentTime();
|
|
1665
1778
|
if (this.player.config.autoplay) {
|
|
1666
1779
|
this.reportStartPlay();
|
|
@@ -1671,14 +1784,16 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1671
1784
|
this.clearPlayResultTimer();
|
|
1672
1785
|
this.log.play_result.start = getCurrentTime();
|
|
1673
1786
|
this.playResultTimer = setTimeout(function() {
|
|
1674
|
-
if (
|
|
1787
|
+
if (_this14.log.play_result.timestamp >= _this14.log.play_result.start)
|
|
1788
|
+
return;
|
|
1789
|
+
if (!_this14.player || _this14.player.paused || !_this14.player.video)
|
|
1675
1790
|
return;
|
|
1676
|
-
|
|
1677
|
-
|
|
1791
|
+
_this14.log.play_result.is_threshold = 1;
|
|
1792
|
+
_this14.logmanager.push(_this14.log.play_result, true);
|
|
1678
1793
|
}, this.log.play_result.threshold);
|
|
1679
1794
|
};
|
|
1680
1795
|
_proto2.handlePlayerWaiting = function handlePlayerWaiting() {
|
|
1681
|
-
var
|
|
1796
|
+
var _this15 = this;
|
|
1682
1797
|
if (!!this.inWaitingStart || !this.log.first_frame.timestamp)
|
|
1683
1798
|
return;
|
|
1684
1799
|
this.log.stall.timestamp = this.inWaitingStart = this.log.stall.stall_start = getCurrentTime();
|
|
@@ -1690,11 +1805,13 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1690
1805
|
this.log.stall.play_current_time = this.player.currentTime;
|
|
1691
1806
|
this.log.stall_start.buffered = this.getBuffered();
|
|
1692
1807
|
this.log.stall.buffered = this.log.stall_start.buffered;
|
|
1693
|
-
|
|
1808
|
+
var _this$getPlayerDownlo = this.getPlayerDownloadSpeed(), speed = _this$getPlayerDownlo.speed, avgSpeed = _this$getPlayerDownlo.avgSpeed;
|
|
1809
|
+
this.log.stall.current_speed = speed;
|
|
1810
|
+
this.log.stall.avg_speed = avgSpeed;
|
|
1694
1811
|
Object.assign(this.log.stall_start, this.videoSize);
|
|
1695
1812
|
this.clearStallTimer();
|
|
1696
1813
|
this.stallStartTimer = setTimeout(function() {
|
|
1697
|
-
|
|
1814
|
+
_this15.logmanager.push(_this15.log.stall_start, true);
|
|
1698
1815
|
}, 205);
|
|
1699
1816
|
};
|
|
1700
1817
|
_proto2.handleVideoseeking = function handleVideoseeking() {
|
|
@@ -1765,37 +1882,36 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1765
1882
|
_proto2.handleVideoended = function handleVideoended() {
|
|
1766
1883
|
this.clearPlayingInterval();
|
|
1767
1884
|
this.clearStallTimer();
|
|
1768
|
-
Object.assign(this.log.playing,
|
|
1769
|
-
timestamp: getCurrentTime(),
|
|
1885
|
+
Object.assign(this.log.playing, {
|
|
1770
1886
|
is_last: 1
|
|
1771
|
-
}
|
|
1772
|
-
this.
|
|
1887
|
+
});
|
|
1888
|
+
this.reportPlaying();
|
|
1773
1889
|
};
|
|
1774
1890
|
_proto2.handleVideoerror = function handleVideoerror() {
|
|
1775
|
-
var
|
|
1891
|
+
var _this16 = this;
|
|
1776
1892
|
this.errorNumber = 1;
|
|
1777
1893
|
var error2 = this.player.video.error;
|
|
1778
1894
|
var firstframeFailed = function firstframeFailed2() {
|
|
1779
|
-
if (
|
|
1895
|
+
if (_this16.log.first_frame.first_frame_view === 0 && !_this16.log.first_frame_failed.code) {
|
|
1780
1896
|
if (error2) {
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
if (
|
|
1784
|
-
|
|
1897
|
+
_this16.log.first_frame_failed.code = error2.code;
|
|
1898
|
+
_this16.log.first_frame_failed.msg = video_error[error2.code];
|
|
1899
|
+
if (_this16.log.first_frame_failed.timestamp !== void 0) {
|
|
1900
|
+
_this16.log.first_frame_failed.timestamp = getCurrentTime();
|
|
1785
1901
|
}
|
|
1786
|
-
|
|
1787
|
-
if (!
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1902
|
+
_this16.logmanager.push(_this16.log.first_frame_failed, true);
|
|
1903
|
+
if (!_this16.log.play_result.is_threshold) {
|
|
1904
|
+
_this16.log.play_result.reason = video_error[error2.code] || "first frame failed";
|
|
1905
|
+
_this16.log.play_result.code = error2.code;
|
|
1906
|
+
_this16.clearPlayResultTimer();
|
|
1907
|
+
_this16.logmanager.push(_this16.log.play_result, true);
|
|
1792
1908
|
}
|
|
1793
1909
|
}
|
|
1794
1910
|
}
|
|
1795
|
-
if (
|
|
1796
|
-
|
|
1911
|
+
if (_this16.options.error_report_stop) {
|
|
1912
|
+
_this16.handleUserLeave();
|
|
1797
1913
|
} else {
|
|
1798
|
-
|
|
1914
|
+
_this16.updatePlayStopParams();
|
|
1799
1915
|
}
|
|
1800
1916
|
};
|
|
1801
1917
|
Object.assign(this.log.play_error, _objectSpread2(_objectSpread2({
|
|
@@ -1816,7 +1932,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1816
1932
|
this.player.once("timeupdate", this.handlePlayerPlaying);
|
|
1817
1933
|
};
|
|
1818
1934
|
_proto2.destroyFunc = function destroyFunc(no_report_stop) {
|
|
1819
|
-
var
|
|
1935
|
+
var _this17 = this;
|
|
1820
1936
|
if (this.destroyed) {
|
|
1821
1937
|
return;
|
|
1822
1938
|
}
|
|
@@ -1830,7 +1946,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1830
1946
|
window.removeEventListener("pagehide", this.handleUserLeave);
|
|
1831
1947
|
}
|
|
1832
1948
|
videoEvts.forEach(function(name) {
|
|
1833
|
-
|
|
1949
|
+
_this17.removeVideoEvt(name, _this17["handleVideo" + name + "Evt"]);
|
|
1834
1950
|
});
|
|
1835
1951
|
if (this.player) {
|
|
1836
1952
|
if (this.player._start) {
|
|
@@ -1854,26 +1970,26 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1854
1970
|
this.player.off("bufferappend", this.handleBufferAppend);
|
|
1855
1971
|
this.player.off("core_event", this.handleCoreEvent);
|
|
1856
1972
|
this.player.off("degrade", this.handleDegrade);
|
|
1857
|
-
this._player = null;
|
|
1858
1973
|
}
|
|
1859
1974
|
this.clearPlayingInterval();
|
|
1860
1975
|
this.clearStallTimer();
|
|
1861
1976
|
this.clearPlayResultTimer();
|
|
1862
1977
|
clearTimeout(this.collectDownloadSpeedTimer);
|
|
1978
|
+
this._player = null;
|
|
1863
1979
|
};
|
|
1864
1980
|
_proto2.handleUserLeave = function handleUserLeave() {
|
|
1865
1981
|
try {
|
|
1866
|
-
var
|
|
1867
|
-
if (
|
|
1982
|
+
var _this19 = this;
|
|
1983
|
+
if (_this19.destroyed || !_this19.started) {
|
|
1868
1984
|
return Promise.resolve();
|
|
1869
1985
|
}
|
|
1870
|
-
|
|
1871
|
-
return Promise.resolve(
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
clearTimeout(
|
|
1876
|
-
|
|
1986
|
+
_this19.destroyed = true;
|
|
1987
|
+
return Promise.resolve(_this19.updatePlayStopParams()).then(function() {
|
|
1988
|
+
_this19.reportPlayStop();
|
|
1989
|
+
_this19.clearPlayingInterval();
|
|
1990
|
+
_this19.clearStallTimer();
|
|
1991
|
+
clearTimeout(_this19.collectDownloadSpeedTimer);
|
|
1992
|
+
_this19.removeWindowListener();
|
|
1877
1993
|
});
|
|
1878
1994
|
} catch (e3) {
|
|
1879
1995
|
return Promise.reject(e3);
|
|
@@ -1904,94 +2020,94 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
1904
2020
|
this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
|
|
1905
2021
|
this.saveBuffered();
|
|
1906
2022
|
}
|
|
1907
|
-
this.logmanager.push(this.log.play_stop
|
|
2023
|
+
this.logmanager.push(this.log.play_stop);
|
|
1908
2024
|
};
|
|
1909
2025
|
_proto2.reportFirstframe = function reportFirstframe() {
|
|
1910
2026
|
if (this.firstFrameViewed) {
|
|
1911
2027
|
return;
|
|
1912
2028
|
}
|
|
1913
2029
|
if (this.core && this.core.getStats) {
|
|
1914
|
-
var
|
|
2030
|
+
var _ref7 = this.core.getStats() || {}, fps = _ref7.fps;
|
|
1915
2031
|
this.commonParams.fps = fps;
|
|
1916
2032
|
}
|
|
2033
|
+
var transferCost = this.getTransferCost(true);
|
|
1917
2034
|
this.firstFrameViewed = true;
|
|
1918
2035
|
var currentTime = getCurrentTime();
|
|
1919
|
-
Object.assign(this.log.first_frame, _objectSpread2({
|
|
2036
|
+
Object.assign(this.log.first_frame, _objectSpread2(_objectSpread2({
|
|
1920
2037
|
first_frame_view: currentTime - this.log.start_play.start_play_time || currentTime,
|
|
1921
2038
|
timestamp: currentTime
|
|
1922
|
-
}, this.videoSize));
|
|
2039
|
+
}, transferCost), this.videoSize));
|
|
1923
2040
|
if (this.log.first_frame.ttfb_end) {
|
|
1924
2041
|
this.log.first_frame.ttdb = currentTime - this.log.first_frame.ttfb_end;
|
|
1925
2042
|
}
|
|
1926
|
-
this.logmanager.push(this.log.first_frame
|
|
2043
|
+
this.logmanager.push(this.log.first_frame);
|
|
1927
2044
|
this.clearPlayResultTimer();
|
|
1928
2045
|
this.log.play_result.result = 1;
|
|
1929
|
-
this.logmanager.push(this.log.play_result
|
|
2046
|
+
this.logmanager.push(this.log.play_result);
|
|
1930
2047
|
this.log.play_stop.is_stream_received = 1;
|
|
1931
2048
|
};
|
|
1932
2049
|
_proto2.updatePlayStopParams = function updatePlayStopParams() {
|
|
1933
2050
|
try {
|
|
1934
|
-
var
|
|
1935
|
-
var
|
|
2051
|
+
var _this21$core;
|
|
2052
|
+
var _temp13 = function _temp132() {
|
|
1936
2053
|
Object.assign(play_stop, _objectSpread2({
|
|
1937
2054
|
timestamp: endTime,
|
|
1938
2055
|
stop_time: endTime,
|
|
1939
|
-
duration:
|
|
1940
|
-
play_time:
|
|
1941
|
-
},
|
|
1942
|
-
if (
|
|
1943
|
-
play_stop.play_time_on_no_frame = play_stop.stop_time -
|
|
2056
|
+
duration: _this21.playedTime / 1e3,
|
|
2057
|
+
play_time: _this21.playedTime / 1e3
|
|
2058
|
+
}, _this21.videoSize));
|
|
2059
|
+
if (_this21.errorNumber === 0) {
|
|
2060
|
+
play_stop.play_time_on_no_frame = play_stop.stop_time - _this21.log.start_play.start_play_time;
|
|
1944
2061
|
}
|
|
1945
2062
|
};
|
|
1946
|
-
var
|
|
1947
|
-
var timing = getResourceTiming(
|
|
2063
|
+
var _this21 = this;
|
|
2064
|
+
var timing = getResourceTiming(_this21._url);
|
|
1948
2065
|
var endTime = getCurrentTime();
|
|
1949
|
-
|
|
1950
|
-
var play_stop =
|
|
2066
|
+
_this21.playedTime = endTime - _this21.log.start_play.start_play_time;
|
|
2067
|
+
var play_stop = _this21.log.play_stop;
|
|
1951
2068
|
Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
|
|
1952
2069
|
stall_time: 0
|
|
1953
2070
|
}));
|
|
1954
|
-
if (
|
|
1955
|
-
play_stop.stall_time += endTime -
|
|
2071
|
+
if (_this21.inWaitingStart && endTime - _this21.inWaitingStart > 200) {
|
|
2072
|
+
play_stop.stall_time += endTime - _this21.inWaitingStart;
|
|
1956
2073
|
}
|
|
1957
|
-
|
|
2074
|
+
_this21.inWaitingStart = 0;
|
|
1958
2075
|
Object.assign(play_stop, _objectSpread2({
|
|
1959
|
-
stall_time_per_100sec: play_stop.stall_time /
|
|
2076
|
+
stall_time_per_100sec: play_stop.stall_time / _this21.playedTime * 100,
|
|
1960
2077
|
// 计算百秒卡顿时长
|
|
1961
|
-
stall_count_per_100sec: play_stop.stall_count * 1e3 /
|
|
2078
|
+
stall_count_per_100sec: play_stop.stall_count * 1e3 / _this21.playedTime * 100
|
|
1962
2079
|
}, timing));
|
|
1963
|
-
if (
|
|
1964
|
-
|
|
2080
|
+
if (_this21.log.play_stop.stall_count_per_100sec === 0) {
|
|
2081
|
+
_this21.log.play_stop.stall_time_per_100sec = 0;
|
|
1965
2082
|
}
|
|
1966
|
-
if (
|
|
2083
|
+
if (_this21.log.play_stop.stall_time_per_100sec > 100 || _this21.log.play_stop.stall_time_per_100sec < 0) {
|
|
1967
2084
|
return Promise.resolve();
|
|
1968
2085
|
}
|
|
1969
|
-
if (
|
|
1970
|
-
Object.assign(
|
|
1971
|
-
timestamp: getCurrentTime(),
|
|
2086
|
+
if (_this21.log.playing.index) {
|
|
2087
|
+
Object.assign(_this21.log.playing, {
|
|
1972
2088
|
is_last: 1
|
|
1973
|
-
}
|
|
1974
|
-
|
|
2089
|
+
});
|
|
2090
|
+
_this21.reportPlaying();
|
|
1975
2091
|
} else {
|
|
1976
|
-
|
|
1977
|
-
|
|
2092
|
+
_this21.log.play_stop.error_code = _this21.log.play_error.code;
|
|
2093
|
+
_this21.log.play_stop.error_info = _this21.log.play_error.info;
|
|
1978
2094
|
}
|
|
1979
2095
|
endTime = getCurrentTime();
|
|
1980
|
-
if ((
|
|
1981
|
-
var
|
|
1982
|
-
Object.assign(
|
|
2096
|
+
if ((_this21$core = _this21.core) === null || _this21$core === void 0 ? void 0 : _this21$core.getStats) {
|
|
2097
|
+
var _ref8 = _this21.core.getStats() || {}, totalReceivedByte = _ref8.totalReceivedByte, totalReceivedCost = _ref8.totalReceivedCost;
|
|
2098
|
+
Object.assign(_this21.log.play_stop, {
|
|
1983
2099
|
totalReceivedByte,
|
|
1984
2100
|
totalReceivedCost,
|
|
1985
2101
|
totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
|
|
1986
2102
|
// bps
|
|
1987
2103
|
});
|
|
1988
2104
|
}
|
|
1989
|
-
var
|
|
1990
|
-
var
|
|
1991
|
-
if ((
|
|
1992
|
-
return Promise.resolve(
|
|
1993
|
-
var video =
|
|
1994
|
-
var
|
|
2105
|
+
var _temp14 = function() {
|
|
2106
|
+
var _this21$core2;
|
|
2107
|
+
if ((_this21$core2 = _this21.core) === null || _this21$core2 === void 0 ? void 0 : _this21$core2.getStatsSnapshoot) {
|
|
2108
|
+
return Promise.resolve(_this21.core.getStatsSnapshoot()).then(function(_ref9) {
|
|
2109
|
+
var video = _ref9.video;
|
|
2110
|
+
var _ref10 = video || {}, packetsLost = _ref10.packetsLost, packetsReceived = _ref10.packetsReceived;
|
|
1995
2111
|
Object.assign(play_stop, {
|
|
1996
2112
|
packetsLost,
|
|
1997
2113
|
packetsReceived,
|
|
@@ -2000,7 +2116,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
|
|
|
2000
2116
|
});
|
|
2001
2117
|
}
|
|
2002
2118
|
}();
|
|
2003
|
-
return Promise.resolve(
|
|
2119
|
+
return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
|
|
2004
2120
|
} catch (e3) {
|
|
2005
2121
|
return Promise.reject(e3);
|
|
2006
2122
|
}
|
|
@@ -2799,8 +2915,6 @@ const Plugin$2 = window["VePlayer"].Plugin;
|
|
|
2799
2915
|
class Logger extends Plugin$2 {
|
|
2800
2916
|
constructor() {
|
|
2801
2917
|
super(...arguments);
|
|
2802
|
-
__publicField(this, "_userId");
|
|
2803
|
-
__publicField(this, "_deviceId");
|
|
2804
2918
|
__publicField(this, "_liveLogger");
|
|
2805
2919
|
}
|
|
2806
2920
|
static get pluginName() {
|
|
@@ -2856,8 +2970,8 @@ class Logger extends Plugin$2 {
|
|
|
2856
2970
|
});
|
|
2857
2971
|
q.start();
|
|
2858
2972
|
q.config({
|
|
2859
|
-
user_unique_id: this.
|
|
2860
|
-
device_id: this.
|
|
2973
|
+
user_unique_id: this.config.userId,
|
|
2974
|
+
device_id: this.config.deviceId
|
|
2861
2975
|
});
|
|
2862
2976
|
}
|
|
2863
2977
|
_start() {
|
|
@@ -2868,11 +2982,11 @@ class Logger extends Plugin$2 {
|
|
|
2868
2982
|
aid: this.config.appId || 654925,
|
|
2869
2983
|
project_key: this.config.appId,
|
|
2870
2984
|
app_name: this.config.appName || this.config.appId,
|
|
2871
|
-
user_id: this.
|
|
2872
|
-
device_id: this.
|
|
2985
|
+
user_id: this.config.userId,
|
|
2986
|
+
device_id: this.config.deviceId,
|
|
2873
2987
|
error_report_stop: true,
|
|
2874
2988
|
ext: {
|
|
2875
|
-
veplayer_version: "2.3.
|
|
2989
|
+
veplayer_version: "2.3.1-rc.1",
|
|
2876
2990
|
flv_version: "3.0.21-rc.21",
|
|
2877
2991
|
hls_version: "3.0.21-rc.21",
|
|
2878
2992
|
rts_version: "0.2.1-alpha.14"
|