@volcengine/veplayer 2.7.1-rc.0 → 2.7.1-rc.2

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.
@@ -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.rtm) {
530
- return player.plugins.rtm;
531
- }
532
- }
533
- return null;
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: !!options.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.12",
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 = ["play", "playing", "pause", "ended", "error", "seeking", "seeked", "timeupdate", "waiting", "canplay", "canplaythrough", "durationchange", "ratechange", "volumechange", "loadeddata"];
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, true);
1352
+ this.logmanager.push(this.log.play_result);
1302
1353
  }
1303
1354
  }
1304
1355
  if (this.options.error_report_stop) {
1305
- this.handleUserLeave();
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
- var _this$log = this.log, playing = _this$log.playing, first_frame = _this$log.first_frame;
1330
- if (sei.code === 100) {
1331
- var seiString = Utf8ArrayToStr(sei.content);
1332
- seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
1333
- try {
1334
- var seiContent = JSON.parse(seiString);
1335
- var seiDelay = this.getPlayerBuffer() + this.ntpTime - seiContent.ts;
1336
- playing.sei_delay = seiDelay;
1337
- playing.sei_source = seiContent.source;
1338
- playing.ntp_sync = this.options.ntp ? 1 : 0;
1339
- playing.ntp_delta = this.ntp_delta;
1340
- first_frame.first_sei_delay = seiDelay;
1341
- first_frame.ntp_sync = this.options.ntp ? 1 : 0;
1342
- first_frame.ntp_delta = this.ntp_delta;
1343
- } catch (e3) {
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, false);
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
- var buffered = this.player.video.buffered;
1395
- if (buffered) {
1396
- var bufferIdx = Math.max(0, buffered.length - 1);
1397
- try {
1398
- var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - this.player.video.currentTime) * 1e3);
1399
- this.log.playing.audio_buffer_time = this.log.playing.video_buffer_time = bufferedTime;
1400
- return bufferedTime;
1401
- } catch (e3) {
1402
- return 0;
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(duration, first) {
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 _this5 = this;
1431
- var rtm = _this5.player.plugins.rts || _this5.player.plugins.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 - (_this5.cacheRtcStats.audioBytesReceived || 0);
1443
- _this5.cacheRtcStats.audioBytesReceived = bytesReceived;
1444
- rtc_stats.audio_packets_lost = packetsLost - (_this5.cacheRtcStats.audioPacketsLost || 0);
1445
- rtc_stats.audio_packets_received = packetsReceived - (_this5.cacheRtcStats.audioPacketsReceived || 0);
1446
- _this5.cacheRtcStats.audioPacketsLost = packetsLost;
1447
- _this5.cacheRtcStats.audioPacketsReceived = packetsReceived;
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 (_this5.cacheRtcStats.totalSamplesReceived !== void 0) {
1452
- rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this5.cacheRtcStats.totalSamplesReceived) / duration;
1548
+ if (_this9.cacheRtcStats.totalSamplesReceived !== void 0) {
1549
+ rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this9.cacheRtcStats.totalSamplesReceived) / duration;
1453
1550
  }
1454
- _this5.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
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 - (_this5.cacheRtcStats.videoBytesReceived || 0);
1461
- _this5.cacheRtcStats.videoBytesReceived = bytesReceived;
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 (_this5.cacheRtcStats.framesDecoded !== void 0) {
1467
- rtc_stats.video_decode_framerate = (framesDecoded - _this5.cacheRtcStats.framesDecoded) / duration;
1567
+ if (_this9.cacheRtcStats.framesDecoded !== void 0) {
1568
+ rtc_stats.video_decode_framerate = (framesDecoded - _this9.cacheRtcStats.framesDecoded) / duration;
1468
1569
  }
1469
- _this5.cacheRtcStats.framesDecoded = framesDecoded;
1470
- if (_this5.cacheRtcStats.framesReceived !== void 0) {
1471
- rtc_stats.video_recv_framerate = (framesReceived - _this5.cacheRtcStats.framesReceived) / duration;
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 (_this5.cacheRtcStats.freezeCount !== void 0) {
1474
- rtc_stats.freeze_count = freezeCount - _this5.cacheRtcStats.freezeCount;
1475
- rtc_stats.freeze_duration = totalFreezesDuration - _this5.cacheRtcStats.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
- _this5.cacheRtcStats.freezeCount = freezeCount;
1478
- _this5.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
1479
- _this5.cacheRtcStats.framesReceived = framesReceived;
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 - (_this5.cacheRtcStats.videoPacketsLost || 0);
1485
- rtc_stats.video_packets_received = packetsReceived - (_this5.cacheRtcStats.videoPacketsReceived || 0);
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
- _this5.cacheRtcStats.videoPacketsLost = packetsLost;
1488
- _this5.cacheRtcStats.videoPacketsReceived = packetsReceived;
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(_this5.log.playing, {
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 _this7 = this;
1532
- if (_this7.commonParams.is_wasm) {
1533
- _this7.commonParams.fps = _this7.player.video.fps;
1534
- _this7.log.playing.render_fps = _this7.player.video.fps;
1535
- _this7.log.playing.decode_fps = _this7.player.video.decodeFps;
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
- _this7.log.playing.index++;
1538
- var lastPlayingTime = _this7.log.playing.timestamp;
1636
+ _this11.log.playing.index++;
1637
+ var lastPlayingTime = _this11.log.playing.timestamp;
1539
1638
  var stallTime;
1540
- if (_this7.inWaitingStart && _this7.inWaitingStart < getCurrentTime()) {
1541
- stallTime = Math.min(_this7.options.playingInterval || _this7.log.playing.play_time, getCurrentTime() - Math.max(_this7.inWaitingStart, lastPlayingTime));
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
- _this7.getPlayerQuality();
1544
- _this7.getPlayerBuffer();
1545
- if (!_this7.options.downloadSpeedInterval) {
1546
- _this7.log.playing.current_speed = _this7.getPlayerDownloadSpeed();
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) + _this7.log.playing.stall_time;
1551
- var stall_count = (stallTime > 200 ? 1 : 0) + _this7.log.playing.stall_count;
1552
- if (_this7.options.aggregationDowngradeStallTime) {
1553
- _this7.log.playing.aggregation_downgrade_stall = (stallTime > _this7.options.aggregationDowngradeStallTime ? stallTime : 0) + (_this7.log.playing.aggregation_downgrade_stall || 0);
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(_this7.log.playing, _objectSpread2({
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: _this7.player.currentTime
1568
- }, _this7.videoSize));
1569
- return Promise.resolve(_this7.getRtcStats(playedTime, first)).then(function(stats) {
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 (_this7.core) {
1572
- if (_this7.core.getStats) {
1573
- var _ref2 = _this7.core.getStats() || {}, bitrate = _ref2.bitrate, avgSpeed = _ref2.avgSpeed;
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: avgSpeed,
1577
- rate: avgSpeed / bitrate
1682
+ avg_speed: _avgSpeed,
1683
+ rate: _avgSpeed / bitrate
1578
1684
  });
1579
1685
  }
1580
- if (_this7.core.getNetWorkInfo) {
1581
- var _this7$core$core;
1582
- var _ref3 = _this7.core.getNetWorkInfo() || {}, lostRate = _ref3.lostRate;
1583
- var _ref4 = ((_this7$core$core = _this7.core.core) === null || _this7$core$core === void 0 ? void 0 : _this7$core$core._opts) || {}, networkEvaluateInterval = _ref4.networkEvaluateInterval;
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
- _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
1696
+ _this11.logmanager.push(Object.assign({}, _this11.log.playing, _objectSpread2(_objectSpread2({
1591
1697
  play_time: first ? 0 : playedTime
1592
1698
  }, stats), flvStats)), true);
1593
- _this7.log.playing.download_speed_array = [];
1594
- _this7.log.playing.stall_time = 0;
1595
- _this7.log.playing.stall_count = 0;
1596
- if (_this7.options.aggregationDowngradeStallTime) {
1597
- _this7.log.playing.aggregation_downgrade_stall = 0;
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 _this9 = this;
1607
- if (_this9.player && _this9.player.video.readyState < 3) {
1712
+ var _this13 = this;
1713
+ if (_this13.player && _this13.player.video.readyState < 3) {
1608
1714
  return Promise.resolve();
1609
1715
  }
1610
- _this9.player.off("playing", _this9.handlePlayerPlaying);
1611
- _this9.player.off("timeupdate", _this9.handlePlayerPlaying);
1612
- if (_this9.core && _this9.core.getStats) {
1613
- var _ref5 = _this9.core.getStats() || {}, fps = _ref5.fps;
1614
- _this9.commonParams.fps = fps;
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
- return Promise.resolve(_this9.reportPlaying(true)).then(function() {
1617
- _this9.clearPlayingInterval();
1618
- var timer = _this9.options.playingInterval || _this9.log.playing.play_time;
1619
- _this9.intervalId = setInterval(function() {
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 _temp4 = function() {
1622
- if (Math.abs(Date.now() - _this9.log.playing.timestamp - timer) < 100 || Date.now() - _this9.log.playing.timestamp >= timer) {
1623
- var _temp5 = function() {
1624
- if (!_this9.player || !_this9.player.video) {
1625
- _this9.destroyFunc();
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 _temp6 = function() {
1628
- if (_this9.player.paused) {
1629
- _this9.handleVideopause();
1740
+ var _temp10 = function() {
1741
+ if (_this13.player.paused) {
1742
+ _this13.handleVideopause();
1630
1743
  } else {
1631
- return Promise.resolve(_this9.reportPlaying()).then(function() {
1744
+ return Promise.resolve(_this13.reportPlaying()).then(function() {
1632
1745
  });
1633
1746
  }
1634
1747
  }();
1635
- if (_temp6 && _temp6.then)
1636
- return _temp6.then(function() {
1748
+ if (_temp10 && _temp10.then)
1749
+ return _temp10.then(function() {
1637
1750
  });
1638
1751
  }
1639
1752
  }();
1640
- if (_temp5 && _temp5.then)
1641
- return _temp5.then(function() {
1753
+ if (_temp9 && _temp9.then)
1754
+ return _temp9.then(function() {
1642
1755
  });
1643
1756
  }
1644
1757
  }();
1645
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function() {
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
- _this9.clearStallTimer();
1652
- _this9.handleVideoplaying();
1653
- if (!_this9.started) {
1654
- _this9.reportStartPlay();
1764
+ _this13.clearStallTimer();
1765
+ _this13.handleVideoplaying();
1766
+ if (!_this13.started) {
1767
+ _this13.reportStartPlay();
1655
1768
  }
1656
- _this9.saveBuffered();
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 _this10 = this;
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 (_this10.log.play_result.timestamp >= _this10.log.play_result.start)
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
- _this10.log.play_result.is_threshold = 1;
1677
- _this10.logmanager.push(_this10.log.play_result, true);
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 _this11 = this;
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
- this.log.stall.current_speed = this.getPlayerDownloadSpeed();
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
- _this11.logmanager.push(_this11.log.stall_start, true);
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, _objectSpread2({
1769
- timestamp: getCurrentTime(),
1885
+ Object.assign(this.log.playing, {
1770
1886
  is_last: 1
1771
- }, this.videoSize));
1772
- this.logmanager.push(this.log.playing);
1887
+ });
1888
+ this.reportPlaying();
1773
1889
  };
1774
1890
  _proto2.handleVideoerror = function handleVideoerror() {
1775
- var _this12 = this;
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 (_this12.log.first_frame.first_frame_view === 0 && !_this12.log.first_frame_failed.code) {
1895
+ if (_this16.log.first_frame.first_frame_view === 0 && !_this16.log.first_frame_failed.code) {
1780
1896
  if (error2) {
1781
- _this12.log.first_frame_failed.code = error2.code;
1782
- _this12.log.first_frame_failed.msg = video_error[error2.code];
1783
- if (_this12.log.first_frame_failed.timestamp !== void 0) {
1784
- _this12.log.first_frame_failed.timestamp = getCurrentTime();
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
- _this12.logmanager.push(_this12.log.first_frame_failed, true);
1787
- if (!_this12.log.play_result.is_threshold) {
1788
- _this12.log.play_result.reason = video_error[error2.code] || "first frame failed";
1789
- _this12.log.play_result.code = error2.code;
1790
- _this12.clearPlayResultTimer();
1791
- _this12.logmanager.push(_this12.log.play_result, true);
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 (_this12.options.error_report_stop) {
1796
- _this12.handleUserLeave();
1911
+ if (_this16.options.error_report_stop) {
1912
+ _this16.handleUserLeave();
1797
1913
  } else {
1798
- _this12.updatePlayStopParams();
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 _this13 = this;
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
- _this13.removeVideoEvt(name, _this13["handleVideo" + name + "Evt"]);
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 _this15 = this;
1867
- if (_this15.destroyed || !_this15.started) {
1982
+ var _this19 = this;
1983
+ if (_this19.destroyed || !_this19.started) {
1868
1984
  return Promise.resolve();
1869
1985
  }
1870
- _this15.destroyed = true;
1871
- return Promise.resolve(_this15.updatePlayStopParams()).then(function() {
1872
- _this15.reportPlayStop();
1873
- _this15.clearPlayingInterval();
1874
- _this15.clearStallTimer();
1875
- clearTimeout(_this15.collectDownloadSpeedTimer);
1876
- _this15.removeWindowListener();
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, true);
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 _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
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, true);
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, true);
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 _this17$core;
1935
- var _temp9 = function _temp92() {
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: _this17.playedTime / 1e3,
1940
- play_time: _this17.playedTime / 1e3
1941
- }, _this17.videoSize));
1942
- if (_this17.errorNumber === 0) {
1943
- play_stop.play_time_on_no_frame = play_stop.stop_time - _this17.log.start_play.start_play_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 _this17 = this;
1947
- var timing = getResourceTiming(_this17._url);
2063
+ var _this21 = this;
2064
+ var timing = getResourceTiming(_this21._url);
1948
2065
  var endTime = getCurrentTime();
1949
- _this17.playedTime = endTime - _this17.log.start_play.start_play_time;
1950
- var play_stop = _this17.log.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 (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
1955
- play_stop.stall_time += endTime - _this17.inWaitingStart;
2071
+ if (_this21.inWaitingStart && endTime - _this21.inWaitingStart > 200) {
2072
+ play_stop.stall_time += endTime - _this21.inWaitingStart;
1956
2073
  }
1957
- _this17.inWaitingStart = 0;
2074
+ _this21.inWaitingStart = 0;
1958
2075
  Object.assign(play_stop, _objectSpread2({
1959
- stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
2076
+ stall_time_per_100sec: play_stop.stall_time / _this21.playedTime * 100,
1960
2077
  // 计算百秒卡顿时长
1961
- stall_count_per_100sec: play_stop.stall_count * 1e3 / _this17.playedTime * 100
2078
+ stall_count_per_100sec: play_stop.stall_count * 1e3 / _this21.playedTime * 100
1962
2079
  }, timing));
1963
- if (_this17.log.play_stop.stall_count_per_100sec === 0) {
1964
- _this17.log.play_stop.stall_time_per_100sec = 0;
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 (_this17.log.play_stop.stall_time_per_100sec > 100 || _this17.log.play_stop.stall_time_per_100sec < 0) {
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 (_this17.log.playing.index) {
1970
- Object.assign(_this17.log.playing, _objectSpread2({
1971
- timestamp: getCurrentTime(),
2086
+ if (_this21.log.playing.index) {
2087
+ Object.assign(_this21.log.playing, {
1972
2088
  is_last: 1
1973
- }, _this17.videoSize));
1974
- _this17.logmanager.push(_this17.log.playing, true);
2089
+ });
2090
+ _this21.reportPlaying();
1975
2091
  } else {
1976
- _this17.log.play_stop.error_code = _this17.log.play_error.code;
1977
- _this17.log.play_stop.error_info = _this17.log.play_error.info;
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 ((_this17$core = _this17.core) === null || _this17$core === void 0 ? void 0 : _this17$core.getStats) {
1981
- var _ref7 = _this17.core.getStats() || {}, totalReceivedByte = _ref7.totalReceivedByte, totalReceivedCost = _ref7.totalReceivedCost;
1982
- Object.assign(_this17.log.play_stop, {
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 _temp10 = function() {
1990
- var _this17$core2;
1991
- if ((_this17$core2 = _this17.core) === null || _this17$core2 === void 0 ? void 0 : _this17$core2.getStatsSnapshoot) {
1992
- return Promise.resolve(_this17.core.getStatsSnapshoot()).then(function(_ref8) {
1993
- var video = _ref8.video;
1994
- var _ref9 = video || {}, packetsLost = _ref9.packetsLost, packetsReceived = _ref9.packetsReceived;
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(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
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._userId,
2860
- device_id: this._deviceId
2973
+ user_unique_id: this.config.userId,
2974
+ device_id: this.config.deviceId
2861
2975
  });
2862
2976
  }
2863
2977
  _start() {
@@ -2868,14 +2982,14 @@ 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._userId,
2872
- device_id: this._deviceId,
2985
+ user_id: this.config.userId,
2986
+ device_id: this.config.deviceId,
2873
2987
  error_report_stop: true,
2874
2988
  ext: {
2875
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
- rts_version: "0.2.1-alpha.14"
2992
+ rts_version: "0.2.1-alpha.24"
2879
2993
  }
2880
2994
  });
2881
2995
  }
@@ -4629,6 +4743,12 @@ class VePlayerLive extends VePlayerBase {
4629
4743
  */
4630
4744
  constructor(options) {
4631
4745
  super(options);
4746
+ /** {en}
4747
+ * @hidden
4748
+ */
4749
+ /** {zh}
4750
+ * @hidden
4751
+ */
4632
4752
  __publicField(this, "_protocolManager");
4633
4753
  }
4634
4754
  /** {zh}
@@ -4739,10 +4859,11 @@ class VePlayerLive extends VePlayerBase {
4739
4859
  }
4740
4860
  /** {zh}
4741
4861
  * @brief 调用此方法更新 DRM 配置。
4862
+ * @param config DRM 配置对象,包含 Fairplay DRM 的相关设置。
4742
4863
  */
4743
4864
  /** {en}
4744
4865
  * @brief Use this method to update DRM configuration.
4745
- * @param config
4866
+ * @param config A configuration object containing settings for Fairplay DRM.
4746
4867
  */
4747
4868
  updateDrmConfig(config) {
4748
4869
  var _a, _b, _c;
@@ -4820,10 +4941,29 @@ class VePlayerLive extends VePlayerBase {
4820
4941
  var _a, _b, _c;
4821
4942
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.hls) == null ? void 0 : _c.getStats();
4822
4943
  }
4944
+ /** {en}
4945
+ * @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
4946
+ * @param playlist The playlist, consisting of multiple `Source` type elements.
4947
+ * @param target An optional target configuration, which can specify the resolution or source. Providing this information helps update the playback source for a specific resolution or stream.
4948
+ * @param needUpdateProtocol Whether the protocol needs to be updated.
4949
+ *
4950
+ * - `true`: Forces the protocol update to ensure compatibility with the playback configuration or source.
4951
+ * - `false`: Does not update the protocol and continues to use the current configuration.
4952
+ */
4953
+ /** {zh}
4954
+ * @brief 调用此方法更新播放列表,支持更新源、清晰度等相关信息。
4955
+ * @param playlist 播放列表,包含多个 `Source` 类型的元素。
4956
+ * @param target 可选的目标配置项,可以指定清晰度或源。提供这些信息可以帮助更新特定清晰度或线路的播放源。
4957
+ * @param needUpdateProtocol 是否需要更新协议。
4958
+ * - `true`:强制更新协议,以确保播放配置或源的兼容性。
4959
+ * - `false`:不更新协议,继续使用当前配置。
4960
+ */
4823
4961
  async updatePlaylist(playlist, target, needUpdateProtocol = true) {
4824
4962
  var _a;
4825
4963
  if (needUpdateProtocol) {
4826
- await ((_a = this._protocolManager) == null ? void 0 : _a.update({ playlist }));
4964
+ await ((_a = this._protocolManager) == null ? void 0 : _a.update({
4965
+ playlist
4966
+ }));
4827
4967
  }
4828
4968
  return super.updatePlaylist(playlist, target);
4829
4969
  }
@@ -4859,7 +4999,9 @@ async function createLivePlayer(options) {
4859
4999
  i18nManager: i18n,
4860
5000
  preProcessUrl: (url) => {
4861
5001
  if (isType(".ts", url)) {
4862
- return { url };
5002
+ return {
5003
+ url
5004
+ };
4863
5005
  }
4864
5006
  return {
4865
5007
  url: generateUrlWithSessionId(url)
@@ -4867,7 +5009,9 @@ async function createLivePlayer(options) {
4867
5009
  },
4868
5010
  async preparePlugins(url) {
4869
5011
  if (!protocolManager.enableSelector) {
4870
- await protocolManager.update({ url });
5012
+ await protocolManager.update({
5013
+ url
5014
+ });
4871
5015
  }
4872
5016
  return protocolManager.getStrategy(player, i18n);
4873
5017
  }