@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.
@@ -327,6 +327,19 @@ var __publicField = (obj, key, value) => {
327
327
  }
328
328
  return target;
329
329
  }
330
+ typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /* @__PURE__ */ Symbol("Symbol.iterator")) : "@@iterator";
331
+ typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /* @__PURE__ */ Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
332
+ function _catch(body, recover) {
333
+ try {
334
+ var result = body();
335
+ } catch (e2) {
336
+ return recover(e2);
337
+ }
338
+ if (result && result.then) {
339
+ return result.then(void 0, recover);
340
+ }
341
+ return result;
342
+ }
330
343
  var device_id_key = "xgplayer_device_id";
331
344
  var user_id_key = "xgplayer_user_id";
332
345
  var getCookie = function getCookie2(key) {
@@ -530,17 +543,25 @@ var __publicField = (obj, key, value) => {
530
543
  return player.plugins.hls;
531
544
  } else if (player.plugins.rts) {
532
545
  return player.plugins.rts;
533
- } else if (player.plugins.rtm) {
534
- return player.plugins.rtm;
535
- }
536
- }
537
- return null;
546
+ } else if (player.plugins.flvlive) {
547
+ return player.plugins.flvlive;
548
+ } else if (player.plugins.hlslive) {
549
+ return player.plugins.hlslive;
550
+ } else if (player.plugins.hlsvod) {
551
+ return player.plugins.hlsvod;
552
+ } else if (player.plugins.hlslivemobile) {
553
+ return player.plugins.hlslivemobile;
554
+ } else if (player.plugins.flvlivemobile) {
555
+ return player.plugins.flvlivemobile;
556
+ }
557
+ }
558
+ return player.newHls || player.newFlv || player.__core__ || player.flv;
538
559
  }
539
560
  function getDefaultOptions(options) {
540
561
  return {
541
562
  device_id: options.device_id || getDeviceID$1(),
542
563
  user_id: options.user_id || getUserId$1(),
543
- error_report_stop: !!options.error_report_stop,
564
+ error_report_stop: typeof options.error_report_stop === "boolean" ? options.error_report_stop : true,
544
565
  project_key: options.project_key || "live",
545
566
  product_line: options.product_line || "live",
546
567
  onReport: options.onReport || function() {
@@ -763,9 +784,8 @@ var __publicField = (obj, key, value) => {
763
784
  live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
764
785
  player_sdk_version: player.version,
765
786
  // eslint-disable-next-line no-undef
766
- logger_version: "1.1.0-alpha.12",
787
+ logger_version: "1.1.0-alpha.17",
767
788
  // 由rollup 在编译时注入
768
- report_version: "5",
769
789
  product_line: options.product_line,
770
790
  user_id: options.user_id,
771
791
  device_id: options.device_id,
@@ -774,6 +794,7 @@ var __publicField = (obj, key, value) => {
774
794
  cdn_ip: options.cdn_ip,
775
795
  is_wasm: +(!!mediaType && mediaType !== "video"),
776
796
  review_is_live: player.config.isLive ? 2 : 1,
797
+ isSupportedH265: isCodecSupport("hev1.1.6.L93.B0,mp4a.40.2"),
777
798
  aid: options.aid,
778
799
  live_id: options.live_id || options.aid + "-" + options.user_id + "-" + Date.now(),
779
800
  is_preview: options.is_preview ? 1 : 0,
@@ -899,6 +920,7 @@ var __publicField = (obj, key, value) => {
899
920
  log.cpu_core_number = cpu_core_number;
900
921
  log.memory_usage = memory_usage;
901
922
  log.network_downlink = network_downlink;
923
+ log.muted = +this._player.muted;
902
924
  Object.assign(log, _objectSpread2({}, this.videoSize));
903
925
  this.send(log);
904
926
  };
@@ -929,14 +951,29 @@ var __publicField = (obj, key, value) => {
929
951
  }
930
952
  return "unknown";
931
953
  };
932
- var videoEvts = ["play", "playing", "pause", "ended", "error", "seeking", "seeked", "timeupdate", "waiting", "canplay", "canplaythrough", "durationchange", "ratechange", "volumechange", "loadeddata"];
954
+ var videoEvts = [
955
+ "play",
956
+ "playing",
957
+ "pause",
958
+ "ended",
959
+ // 'error',
960
+ "seeking",
961
+ "seeked",
962
+ "timeupdate",
963
+ "waiting",
964
+ "canplay",
965
+ "canplaythrough",
966
+ "durationchange",
967
+ "ratechange",
968
+ "volumechange",
969
+ "loadeddata"
970
+ ];
933
971
  var LoggerControl = /* @__PURE__ */ function() {
934
972
  function LoggerControl2(options) {
935
973
  this.options = options;
936
974
  this.logger = new XgLiveLogger(options);
937
975
  this.restart = this.restart.bind(this);
938
976
  this.bindUrlChange();
939
- sniffer.browser.includes("Chrome");
940
977
  }
941
978
  var _proto = LoggerControl2.prototype;
942
979
  _proto.restart = function restart(report_stop) {
@@ -960,6 +997,9 @@ var __publicField = (obj, key, value) => {
960
997
  this.logger.updateExt(ext);
961
998
  }
962
999
  };
1000
+ _proto.sendLog = function sendLog(log) {
1001
+ this.logger.sendLog(log);
1002
+ };
963
1003
  _proto.destroy = function destroy(report_stop) {
964
1004
  this.logger.destroy(report_stop);
965
1005
  this.logger = null;
@@ -1021,6 +1061,7 @@ var __publicField = (obj, key, value) => {
1021
1061
  this.completed = false;
1022
1062
  this.firstFrameViewed = false;
1023
1063
  this.cacheRtcStats = {};
1064
+ this.cachePlaying = {};
1024
1065
  }
1025
1066
  var _proto2 = XgLiveLogger2.prototype;
1026
1067
  _proto2.setNTP = function setNTP(ntp) {
@@ -1110,6 +1151,14 @@ var __publicField = (obj, key, value) => {
1110
1151
  });
1111
1152
  }
1112
1153
  };
1154
+ _proto2.sendLog = function sendLog(log) {
1155
+ for (var commonKey in this.commonParams) {
1156
+ if (log[commonKey] === void 0) {
1157
+ log[commonKey] = this["_" + commonKey] || this.commonParams[commonKey];
1158
+ }
1159
+ }
1160
+ this.logmanager.push(log);
1161
+ };
1113
1162
  _proto2.updateExt = function updateExt(ext) {
1114
1163
  for (var logKey in this.log) {
1115
1164
  for (var extKey in ext) {
@@ -1248,9 +1297,11 @@ var __publicField = (obj, key, value) => {
1248
1297
  };
1249
1298
  };
1250
1299
  _proto2.handleTTFB = function handleTTFB(params) {
1251
- var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed;
1300
+ var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed, responseUrl = _ref.responseUrl, url = _ref.url;
1252
1301
  this.log.first_frame.ttfb = elapsed || -1;
1253
1302
  this.log.first_frame.ttfb_end = end || 0;
1303
+ this.log.first_frame.is_redirect = +(url !== responseUrl);
1304
+ this.log.play_result.is_redirect = this.log.first_frame.is_redirect;
1254
1305
  };
1255
1306
  _proto2.handleUrlChange = function handleUrlChange(url) {
1256
1307
  this.logmanager.push(Object.assign(this.log.play_url_change, {
@@ -1302,11 +1353,11 @@ var __publicField = (obj, key, value) => {
1302
1353
  this.clearPlayResultTimer();
1303
1354
  this.log.play_result.reason = err.message || "first frame failed";
1304
1355
  this.log.play_result.code = this.log.play_error.code;
1305
- this.logmanager.push(this.log.play_result, true);
1356
+ this.logmanager.push(this.log.play_result);
1306
1357
  }
1307
1358
  }
1308
1359
  if (this.options.error_report_stop) {
1309
- this.handleUserLeave();
1360
+ this.destroy(true);
1310
1361
  } else {
1311
1362
  this.updatePlayStopParams();
1312
1363
  }
@@ -1330,22 +1381,36 @@ var __publicField = (obj, key, value) => {
1330
1381
  this.logmanager.push(play_stream_loaded);
1331
1382
  };
1332
1383
  _proto2.handleSEIParsed = function handleSEIParsed(sei) {
1333
- var _this$log = this.log, playing = _this$log.playing, first_frame = _this$log.first_frame;
1334
- if (sei.code === 100) {
1335
- var seiString = Utf8ArrayToStr(sei.content);
1336
- seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
1337
- try {
1338
- var seiContent = JSON.parse(seiString);
1339
- var seiDelay = this.getPlayerBuffer() + this.ntpTime - seiContent.ts;
1340
- playing.sei_delay = seiDelay;
1341
- playing.sei_source = seiContent.source;
1342
- playing.ntp_sync = this.options.ntp ? 1 : 0;
1343
- playing.ntp_delta = this.ntp_delta;
1344
- first_frame.first_sei_delay = seiDelay;
1345
- first_frame.ntp_sync = this.options.ntp ? 1 : 0;
1346
- first_frame.ntp_delta = this.ntp_delta;
1347
- } catch (e2) {
1348
- }
1384
+ try {
1385
+ var _this5 = this;
1386
+ var _this5$log = _this5.log, playing = _this5$log.playing, first_frame = _this5$log.first_frame;
1387
+ var _temp3 = function() {
1388
+ if (sei.code === 100) {
1389
+ var seiString = Utf8ArrayToStr(sei.content);
1390
+ seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
1391
+ var _temp4 = _catch(function() {
1392
+ var seiContent = JSON.parse(seiString);
1393
+ return Promise.resolve(_this5.getPlayerBuffer()).then(function(bufferTime) {
1394
+ var seiDelay = bufferTime + _this5.ntpTime - seiContent.ts;
1395
+ playing.sei_delay = seiDelay;
1396
+ playing.sei_source = seiContent.source;
1397
+ playing.ntp_sync = _this5.options.ntp ? 1 : 0;
1398
+ playing.ntp_delta = _this5.ntp_delta;
1399
+ first_frame.first_sei_delay = seiDelay;
1400
+ first_frame.ntp_sync = _this5.options.ntp ? 1 : 0;
1401
+ first_frame.ntp_delta = _this5.ntp_delta;
1402
+ });
1403
+ }, function() {
1404
+ });
1405
+ if (_temp4 && _temp4.then)
1406
+ return _temp4.then(function() {
1407
+ });
1408
+ }
1409
+ }();
1410
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function() {
1411
+ }) : void 0);
1412
+ } catch (e2) {
1413
+ return Promise.reject(e2);
1349
1414
  }
1350
1415
  };
1351
1416
  _proto2.handleMetaDataLoaded = function handleMetaDataLoaded(type, meta) {
@@ -1375,7 +1440,7 @@ var __publicField = (obj, key, value) => {
1375
1440
  _proto2.handleAVUnsync = function handleAVUnsync(unsyncInfo) {
1376
1441
  Object.assign(this.log.play_av_unsync, unsyncInfo || {});
1377
1442
  this.log.play_av_unsync.timestamp = getCurrentTime();
1378
- this.logmanager.push(this.log.play_av_unsync, false);
1443
+ this.logmanager.push(this.log.play_av_unsync);
1379
1444
  };
1380
1445
  _proto2.handleStreamException = function handleStreamException(info) {
1381
1446
  this.logmanager.push(Object.assign({}, this.log.stream_exception, info));
@@ -1395,27 +1460,58 @@ var __publicField = (obj, key, value) => {
1395
1460
  }
1396
1461
  };
1397
1462
  _proto2.getPlayerBuffer = function getPlayerBuffer() {
1398
- var buffered = this.player.video.buffered;
1399
- if (buffered) {
1400
- var bufferIdx = Math.max(0, buffered.length - 1);
1401
- try {
1402
- var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - this.player.video.currentTime) * 1e3);
1403
- this.log.playing.audio_buffer_time = this.log.playing.video_buffer_time = bufferedTime;
1404
- return bufferedTime;
1405
- } catch (e2) {
1406
- return 0;
1407
- }
1463
+ try {
1464
+ var _this7 = this;
1465
+ return Promise.resolve(_this7.getRtcStats({
1466
+ onlyJb: true
1467
+ })).then(function(rtc_stats) {
1468
+ if (rtc_stats.video_jb_delay !== void 0) {
1469
+ return rtc_stats.video_jb_delay;
1470
+ }
1471
+ var buffered = _this7.player.video.buffered;
1472
+ if (buffered) {
1473
+ var bufferIdx = Math.max(0, buffered.length - 1);
1474
+ try {
1475
+ var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - _this7.player.video.currentTime) * 1e3);
1476
+ _this7.log.playing.audio_buffer_time = _this7.log.playing.video_buffer_time = bufferedTime;
1477
+ return bufferedTime;
1478
+ } catch (e2) {
1479
+ return 0;
1480
+ }
1481
+ }
1482
+ });
1483
+ } catch (e2) {
1484
+ return Promise.reject(e2);
1408
1485
  }
1409
1486
  };
1487
+ _proto2.getTransferCost = function getTransferCost(isFirstFrame) {
1488
+ var _this$core;
1489
+ if (!((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.transferCost)) {
1490
+ return {};
1491
+ }
1492
+ if (isFirstFrame)
1493
+ return this.core.transferCost;
1494
+ var _this$core$transferCo = this.core.transferCost, demuxCost = _this$core$transferCo.demuxCost, remuxCost = _this$core$transferCo.remuxCost, appendCost = _this$core$transferCo.appendCost;
1495
+ var transferCost = {
1496
+ demuxCost: demuxCost - this.cachePlaying.demuxCost,
1497
+ remuxCost: remuxCost - this.cachePlaying.remuxCost,
1498
+ appendCost: appendCost - this.cachePlaying.appendCost
1499
+ };
1500
+ Object.assign(this.cachePlaying, this.core.transferCost);
1501
+ return transferCost;
1502
+ };
1410
1503
  _proto2.getPlayerDownloadSpeed = function getPlayerDownloadSpeed() {
1411
1504
  if (this.core && this.core.core) {
1412
1505
  if (typeof this.core.core.speedInfo === "function") {
1413
- return this.core.core.speedInfo().speed;
1506
+ return this.core.core.speedInfo().speed || {};
1414
1507
  }
1415
1508
  }
1509
+ return {};
1416
1510
  };
1417
1511
  _proto2.getPlayerQuality = function getPlayerQuality() {
1418
1512
  var video = this.player.video;
1513
+ if (!video)
1514
+ return;
1419
1515
  if (video.getVideoPlaybackQuality) {
1420
1516
  var quality = video.getVideoPlaybackQuality();
1421
1517
  this.log.playing.drop_count = quality.droppedVideoFrames - this.tempDroppedFrameCount;
@@ -1429,10 +1525,11 @@ var __publicField = (obj, key, value) => {
1429
1525
  this.tempDroppedFrameCount = droppedVideoFrames;
1430
1526
  }
1431
1527
  };
1432
- _proto2.getRtcStats = function getRtcStats(duration, first) {
1528
+ _proto2.getRtcStats = function getRtcStats(_ref2) {
1529
+ 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;
1433
1530
  try {
1434
- var _this5 = this;
1435
- var rtm = _this5.player.plugins.rts || _this5.player.plugins.rtm;
1531
+ var _this9 = this;
1532
+ var rtm = _this9.player.plugins.rts || _this9.player.plugins.rtm;
1436
1533
  var pc = rtm && rtm.pc;
1437
1534
  var rtc_stats = {};
1438
1535
  if (!pc)
@@ -1443,53 +1540,56 @@ var __publicField = (obj, key, value) => {
1443
1540
  switch (type) {
1444
1541
  case "inbound-rtp":
1445
1542
  if (mediaType === "audio") {
1446
- rtc_stats.audio_bytes_received = bytesReceived - (_this5.cacheRtcStats.audioBytesReceived || 0);
1447
- _this5.cacheRtcStats.audioBytesReceived = bytesReceived;
1448
- rtc_stats.audio_packets_lost = packetsLost - (_this5.cacheRtcStats.audioPacketsLost || 0);
1449
- rtc_stats.audio_packets_received = packetsReceived - (_this5.cacheRtcStats.audioPacketsReceived || 0);
1450
- _this5.cacheRtcStats.audioPacketsLost = packetsLost;
1451
- _this5.cacheRtcStats.audioPacketsReceived = packetsReceived;
1543
+ rtc_stats.audio_bytes_received = bytesReceived - (_this9.cacheRtcStats.audioBytesReceived || 0);
1544
+ _this9.cacheRtcStats.audioBytesReceived = bytesReceived;
1545
+ rtc_stats.audio_packets_lost = packetsLost - (_this9.cacheRtcStats.audioPacketsLost || 0);
1546
+ rtc_stats.audio_packets_received = packetsReceived - (_this9.cacheRtcStats.audioPacketsReceived || 0);
1547
+ _this9.cacheRtcStats.audioPacketsLost = packetsLost;
1548
+ _this9.cacheRtcStats.audioPacketsReceived = packetsReceived;
1452
1549
  rtc_stats.audio_level = audioLevel;
1453
1550
  rtc_stats.concealment_event = concealmentEvents;
1454
1551
  rtc_stats.audio_fraction_lost = rtc_stats.audio_packets_lost / rtc_stats.audio_packets_received;
1455
- if (_this5.cacheRtcStats.totalSamplesReceived !== void 0) {
1456
- rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this5.cacheRtcStats.totalSamplesReceived) / duration;
1552
+ if (_this9.cacheRtcStats.totalSamplesReceived !== void 0) {
1553
+ rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this9.cacheRtcStats.totalSamplesReceived) / duration;
1457
1554
  }
1458
- _this5.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
1555
+ _this9.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
1459
1556
  rtc_stats.concealed_samples = concealedSamples;
1460
1557
  rtc_stats.total_samples_received = totalSamplesReceived;
1461
1558
  } else {
1559
+ rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
1560
+ if (onlyJb) {
1561
+ return rtc_stats;
1562
+ }
1462
1563
  rtc_stats.frames_dropped = framesDropped;
1463
1564
  rtc_stats.iframes_decoded = keyFramesDecoded;
1464
- rtc_stats.video_bytes_received = bytesReceived - (_this5.cacheRtcStats.videoBytesReceived || 0);
1465
- _this5.cacheRtcStats.videoBytesReceived = bytesReceived;
1565
+ rtc_stats.video_bytes_received = bytesReceived - (_this9.cacheRtcStats.videoBytesReceived || 0);
1566
+ _this9.cacheRtcStats.videoBytesReceived = bytesReceived;
1466
1567
  rtc_stats.video_dec_time = totalDecodeTime;
1467
1568
  rtc_stats.video_decoded_delay_ms = rtc_stats.video_dec_elapse / framesDecoded;
1468
1569
  rtc_stats.video_frame_height = frameHeight;
1469
1570
  rtc_stats.video_frame_width = frameWidth;
1470
- if (_this5.cacheRtcStats.framesDecoded !== void 0) {
1471
- rtc_stats.video_decode_framerate = (framesDecoded - _this5.cacheRtcStats.framesDecoded) / duration;
1571
+ if (_this9.cacheRtcStats.framesDecoded !== void 0) {
1572
+ rtc_stats.video_decode_framerate = (framesDecoded - _this9.cacheRtcStats.framesDecoded) / duration;
1472
1573
  }
1473
- _this5.cacheRtcStats.framesDecoded = framesDecoded;
1474
- if (_this5.cacheRtcStats.framesReceived !== void 0) {
1475
- rtc_stats.video_recv_framerate = (framesReceived - _this5.cacheRtcStats.framesReceived) / duration;
1574
+ _this9.cacheRtcStats.framesDecoded = framesDecoded;
1575
+ if (_this9.cacheRtcStats.framesReceived !== void 0) {
1576
+ rtc_stats.video_recv_framerate = (framesReceived - _this9.cacheRtcStats.framesReceived) / duration;
1476
1577
  }
1477
- if (_this5.cacheRtcStats.freezeCount !== void 0) {
1478
- rtc_stats.freeze_count = freezeCount - _this5.cacheRtcStats.freezeCount;
1479
- rtc_stats.freeze_duration = totalFreezesDuration - _this5.cacheRtcStats.totalFreezesDuration;
1578
+ if (_this9.cacheRtcStats.freezeCount !== void 0) {
1579
+ rtc_stats.freeze_count = freezeCount - _this9.cacheRtcStats.freezeCount;
1580
+ rtc_stats.freeze_duration = totalFreezesDuration - _this9.cacheRtcStats.totalFreezesDuration;
1480
1581
  }
1481
- _this5.cacheRtcStats.freezeCount = freezeCount;
1482
- _this5.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
1483
- _this5.cacheRtcStats.framesReceived = framesReceived;
1582
+ _this9.cacheRtcStats.freezeCount = freezeCount;
1583
+ _this9.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
1584
+ _this9.cacheRtcStats.framesReceived = framesReceived;
1484
1585
  rtc_stats.total_pauses_duration = totalPausesDuration;
1485
- rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
1486
1586
  rtc_stats.video_jitter = jitter * 1e3;
1487
1587
  rtc_stats.video_nack_count = nackCount;
1488
- rtc_stats.video_packets_lost = packetsLost - (_this5.cacheRtcStats.videoPacketsLost || 0);
1489
- rtc_stats.video_packets_received = packetsReceived - (_this5.cacheRtcStats.videoPacketsReceived || 0);
1588
+ rtc_stats.video_packets_lost = packetsLost - (_this9.cacheRtcStats.videoPacketsLost || 0);
1589
+ rtc_stats.video_packets_received = packetsReceived - (_this9.cacheRtcStats.videoPacketsReceived || 0);
1490
1590
  rtc_stats.video_fraction_lost = rtc_stats.video_packets_lost / rtc_stats.video_packets_received;
1491
- _this5.cacheRtcStats.videoPacketsLost = packetsLost;
1492
- _this5.cacheRtcStats.videoPacketsReceived = packetsReceived;
1591
+ _this9.cacheRtcStats.videoPacketsLost = packetsLost;
1592
+ _this9.cacheRtcStats.videoPacketsReceived = packetsReceived;
1493
1593
  rtc_stats.video_pli_count = pliCount;
1494
1594
  rtc_stats.decoder_name = decoderImplementation;
1495
1595
  }
@@ -1513,13 +1613,12 @@ var __publicField = (obj, key, value) => {
1513
1613
  rtc_stats.audio_codec = mediaType;
1514
1614
  }
1515
1615
  }
1516
- rtc_stats.total_delay = rtc_stats.e2e_delay_ms + (rtc_stats.video_decoded_delay_ms || 0) + (rtc_stats.video_jb_delay || 0);
1517
1616
  });
1518
- Object.assign(_this5.log.playing, {
1617
+ Object.assign(_this9.log.playing, {
1519
1618
  video_download_size: rtc_stats.video_bytes_received,
1520
1619
  decode_fps: rtc_stats.video_decode_framerate,
1521
- sei_delay: rtc_stats.total_delay,
1522
- sei_network_delay: rtc_stats.e2e_delay_ms,
1620
+ // sei_delay: rtc_stats.total_delay,
1621
+ // sei_network_delay: rtc_stats.e2e_delay_ms,
1523
1622
  width: rtc_stats.video_frame_width,
1524
1623
  height: rtc_stats.video_frame_height,
1525
1624
  current_speed: (rtc_stats.audio_bytes_received + rtc_stats.video_bytes_received) / duration
@@ -1532,31 +1631,34 @@ var __publicField = (obj, key, value) => {
1532
1631
  };
1533
1632
  _proto2.reportPlaying = function reportPlaying(first) {
1534
1633
  try {
1535
- var _this7 = this;
1536
- if (_this7.commonParams.is_wasm) {
1537
- _this7.commonParams.fps = _this7.player.video.fps;
1538
- _this7.log.playing.render_fps = _this7.player.video.fps;
1539
- _this7.log.playing.decode_fps = _this7.player.video.decodeFps;
1634
+ var _this11 = this;
1635
+ if (_this11.commonParams.is_wasm) {
1636
+ _this11.commonParams.fps = _this11.player.video.fps;
1637
+ _this11.log.playing.render_fps = _this11.player.video.fps;
1638
+ _this11.log.playing.decode_fps = _this11.player.video.decodeFps;
1540
1639
  }
1541
- _this7.log.playing.index++;
1542
- var lastPlayingTime = _this7.log.playing.timestamp;
1640
+ _this11.log.playing.index++;
1641
+ var lastPlayingTime = _this11.log.playing.timestamp;
1543
1642
  var stallTime;
1544
- if (_this7.inWaitingStart && _this7.inWaitingStart < getCurrentTime()) {
1545
- stallTime = Math.min(_this7.options.playingInterval || _this7.log.playing.play_time, getCurrentTime() - Math.max(_this7.inWaitingStart, lastPlayingTime));
1643
+ if (_this11.inWaitingStart && _this11.inWaitingStart < getCurrentTime()) {
1644
+ stallTime = Math.min(_this11.options.playingInterval || _this11.log.playing.play_time, getCurrentTime() - Math.max(_this11.inWaitingStart, lastPlayingTime));
1546
1645
  }
1547
- _this7.getPlayerQuality();
1548
- _this7.getPlayerBuffer();
1549
- if (!_this7.options.downloadSpeedInterval) {
1550
- _this7.log.playing.current_speed = _this7.getPlayerDownloadSpeed();
1646
+ _this11.getPlayerQuality();
1647
+ _this11.getPlayerBuffer();
1648
+ var transferCost = _this11.getTransferCost(false);
1649
+ if (!_this11.options.downloadSpeedInterval) {
1650
+ var _this11$getPlayerDown = _this11.getPlayerDownloadSpeed(), speed = _this11$getPlayerDown.speed, avgSpeed = _this11$getPlayerDown.avgSpeed;
1651
+ _this11.log.playing.current_speed = speed;
1652
+ _this11.log.playing.avg_speed = avgSpeed;
1551
1653
  }
1552
1654
  var now2 = getCurrentTime();
1553
1655
  var playedTime = now2 - lastPlayingTime;
1554
- var stall_time = (stallTime > 200 ? stallTime : 0) + _this7.log.playing.stall_time;
1555
- var stall_count = (stallTime > 200 ? 1 : 0) + _this7.log.playing.stall_count;
1556
- if (_this7.options.aggregationDowngradeStallTime) {
1557
- _this7.log.playing.aggregation_downgrade_stall = (stallTime > _this7.options.aggregationDowngradeStallTime ? stallTime : 0) + (_this7.log.playing.aggregation_downgrade_stall || 0);
1656
+ var stall_time = (stallTime > 200 ? stallTime : 0) + _this11.log.playing.stall_time;
1657
+ var stall_count = (stallTime > 200 ? 1 : 0) + _this11.log.playing.stall_count;
1658
+ if (_this11.options.aggregationDowngradeStallTime) {
1659
+ _this11.log.playing.aggregation_downgrade_stall = (stallTime > _this11.options.aggregationDowngradeStallTime ? stallTime : 0) + (_this11.log.playing.aggregation_downgrade_stall || 0);
1558
1660
  }
1559
- Object.assign(_this7.log.playing, _objectSpread2({
1661
+ Object.assign(_this11.log.playing, _objectSpread2(_objectSpread2({
1560
1662
  timestamp: now2,
1561
1663
  // 60s内存在多次触发playing
1562
1664
  stop_time: now2,
@@ -1568,37 +1670,41 @@ var __publicField = (obj, key, value) => {
1568
1670
  stall_count,
1569
1671
  // playing前会有一次卡顿现处于waiting状态
1570
1672
  stall_time,
1571
- play_current_time: _this7.player.currentTime
1572
- }, _this7.videoSize));
1573
- return Promise.resolve(_this7.getRtcStats(playedTime, first)).then(function(stats) {
1673
+ play_current_time: _this11.player.currentTime
1674
+ }, transferCost), _this11.videoSize));
1675
+ return Promise.resolve(_this11.getRtcStats({
1676
+ duration: playedTime,
1677
+ first,
1678
+ onlyJb: false
1679
+ })).then(function(stats) {
1574
1680
  var flvStats = {};
1575
- if (_this7.core) {
1576
- if (_this7.core.getStats) {
1577
- var _ref2 = _this7.core.getStats() || {}, bitrate = _ref2.bitrate, avgSpeed = _ref2.avgSpeed;
1681
+ if (_this11.core) {
1682
+ if (_this11.core.getStats) {
1683
+ var _ref3 = _this11.core.getStats() || {}, bitrate = _ref3.bitrate, _avgSpeed = _ref3.avgSpeed;
1578
1684
  Object.assign(flvStats, {
1579
1685
  bitrate,
1580
- avg_speed: avgSpeed,
1581
- rate: avgSpeed / bitrate
1686
+ avg_speed: _avgSpeed,
1687
+ rate: _avgSpeed / bitrate
1582
1688
  });
1583
1689
  }
1584
- if (_this7.core.getNetWorkInfo) {
1585
- var _this7$core$core;
1586
- var _ref3 = _this7.core.getNetWorkInfo() || {}, lostRate = _ref3.lostRate;
1587
- var _ref4 = ((_this7$core$core = _this7.core.core) === null || _this7$core$core === void 0 ? void 0 : _this7$core$core._opts) || {}, networkEvaluateInterval = _ref4.networkEvaluateInterval;
1690
+ if (_this11.core.getNetWorkInfo) {
1691
+ var _this11$core$core;
1692
+ var _ref4 = _this11.core.getNetWorkInfo() || {}, lostRate = _ref4.lostRate;
1693
+ var _ref5 = ((_this11$core$core = _this11.core.core) === null || _this11$core$core === void 0 ? void 0 : _this11$core$core._opts) || {}, networkEvaluateInterval = _ref5.networkEvaluateInterval;
1588
1694
  Object.assign(flvStats, {
1589
1695
  lostRate,
1590
1696
  networkEvaluateInterval
1591
1697
  });
1592
1698
  }
1593
1699
  }
1594
- _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
1700
+ _this11.logmanager.push(Object.assign({}, _this11.log.playing, _objectSpread2(_objectSpread2({
1595
1701
  play_time: first ? 0 : playedTime
1596
1702
  }, stats), flvStats)), true);
1597
- _this7.log.playing.download_speed_array = [];
1598
- _this7.log.playing.stall_time = 0;
1599
- _this7.log.playing.stall_count = 0;
1600
- if (_this7.options.aggregationDowngradeStallTime) {
1601
- _this7.log.playing.aggregation_downgrade_stall = 0;
1703
+ _this11.log.playing.download_speed_array = [];
1704
+ _this11.log.playing.stall_time = 0;
1705
+ _this11.log.playing.stall_count = 0;
1706
+ if (_this11.options.aggregationDowngradeStallTime) {
1707
+ _this11.log.playing.aggregation_downgrade_stall = 0;
1602
1708
  }
1603
1709
  });
1604
1710
  } catch (e2) {
@@ -1607,64 +1713,71 @@ var __publicField = (obj, key, value) => {
1607
1713
  };
1608
1714
  _proto2.handlePlayerPlaying = function handlePlayerPlaying() {
1609
1715
  try {
1610
- var _this9 = this;
1611
- if (_this9.player && _this9.player.video.readyState < 3) {
1716
+ var _this13 = this;
1717
+ if (_this13.player && _this13.player.video.readyState < 3) {
1612
1718
  return Promise.resolve();
1613
1719
  }
1614
- _this9.player.off("playing", _this9.handlePlayerPlaying);
1615
- _this9.player.off("timeupdate", _this9.handlePlayerPlaying);
1616
- if (_this9.core && _this9.core.getStats) {
1617
- var _ref5 = _this9.core.getStats() || {}, fps = _ref5.fps;
1618
- _this9.commonParams.fps = fps;
1720
+ _this13.player.off("playing", _this13.handlePlayerPlaying);
1721
+ _this13.player.off("timeupdate", _this13.handlePlayerPlaying);
1722
+ if (!_this13.player.video) {
1723
+ _this13.destroyFunc();
1724
+ return Promise.resolve();
1725
+ } else if (_this13.player.paused) {
1726
+ _this13.handleVideopause();
1727
+ return Promise.resolve();
1619
1728
  }
1620
- return Promise.resolve(_this9.reportPlaying(true)).then(function() {
1621
- _this9.clearPlayingInterval();
1622
- var timer = _this9.options.playingInterval || _this9.log.playing.play_time;
1623
- _this9.intervalId = setInterval(function() {
1729
+ if (_this13.core && _this13.core.getStats) {
1730
+ var _ref6 = _this13.core.getStats() || {}, fps = _ref6.fps;
1731
+ _this13.commonParams.fps = fps;
1732
+ }
1733
+ return Promise.resolve(_this13.reportPlaying(true)).then(function() {
1734
+ _this13.clearPlayingInterval();
1735
+ var timer = _this13.options.playingInterval || _this13.log.playing.play_time;
1736
+ _this13.intervalId = setInterval(function() {
1624
1737
  try {
1625
- var _temp4 = function() {
1626
- if (Math.abs(Date.now() - _this9.log.playing.timestamp - timer) < 100 || Date.now() - _this9.log.playing.timestamp >= timer) {
1627
- var _temp5 = function() {
1628
- if (!_this9.player || !_this9.player.video) {
1629
- _this9.destroyFunc();
1738
+ var _temp8 = function() {
1739
+ if (Math.abs(Date.now() - _this13.log.playing.timestamp - timer) < 100 || Date.now() - _this13.log.playing.timestamp >= timer) {
1740
+ var _temp9 = function() {
1741
+ if (!_this13.player || !_this13.player.video) {
1742
+ _this13.destroyFunc();
1630
1743
  } else {
1631
- var _temp6 = function() {
1632
- if (_this9.player.paused) {
1633
- _this9.handleVideopause();
1744
+ var _temp10 = function() {
1745
+ if (_this13.player.paused) {
1746
+ _this13.handleVideopause();
1634
1747
  } else {
1635
- return Promise.resolve(_this9.reportPlaying()).then(function() {
1748
+ return Promise.resolve(_this13.reportPlaying()).then(function() {
1636
1749
  });
1637
1750
  }
1638
1751
  }();
1639
- if (_temp6 && _temp6.then)
1640
- return _temp6.then(function() {
1752
+ if (_temp10 && _temp10.then)
1753
+ return _temp10.then(function() {
1641
1754
  });
1642
1755
  }
1643
1756
  }();
1644
- if (_temp5 && _temp5.then)
1645
- return _temp5.then(function() {
1757
+ if (_temp9 && _temp9.then)
1758
+ return _temp9.then(function() {
1646
1759
  });
1647
1760
  }
1648
1761
  }();
1649
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function() {
1762
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function() {
1650
1763
  }) : void 0);
1651
1764
  } catch (e2) {
1652
1765
  return Promise.reject(e2);
1653
1766
  }
1654
1767
  }, 1e3);
1655
- _this9.clearStallTimer();
1656
- _this9.handleVideoplaying();
1657
- if (!_this9.started) {
1658
- _this9.reportStartPlay();
1768
+ _this13.clearStallTimer();
1769
+ _this13.handleVideoplaying();
1770
+ if (!_this13.started) {
1771
+ _this13.reportStartPlay();
1659
1772
  }
1660
- _this9.saveBuffered();
1773
+ _this13.saveBuffered();
1661
1774
  });
1662
1775
  } catch (e2) {
1663
1776
  return Promise.reject(e2);
1664
1777
  }
1665
1778
  };
1666
1779
  _proto2.handlePlayerReady = function handlePlayerReady() {
1667
- var _this10 = this;
1780
+ var _this14 = this;
1668
1781
  this.log.start_play.start_play_time = getCurrentTime();
1669
1782
  if (this.player.config.autoplay) {
1670
1783
  this.reportStartPlay();
@@ -1675,14 +1788,16 @@ var __publicField = (obj, key, value) => {
1675
1788
  this.clearPlayResultTimer();
1676
1789
  this.log.play_result.start = getCurrentTime();
1677
1790
  this.playResultTimer = setTimeout(function() {
1678
- if (_this10.log.play_result.timestamp >= _this10.log.play_result.start)
1791
+ if (_this14.log.play_result.timestamp >= _this14.log.play_result.start)
1792
+ return;
1793
+ if (!_this14.player || _this14.player.paused || !_this14.player.video)
1679
1794
  return;
1680
- _this10.log.play_result.is_threshold = 1;
1681
- _this10.logmanager.push(_this10.log.play_result, true);
1795
+ _this14.log.play_result.is_threshold = 1;
1796
+ _this14.logmanager.push(_this14.log.play_result, true);
1682
1797
  }, this.log.play_result.threshold);
1683
1798
  };
1684
1799
  _proto2.handlePlayerWaiting = function handlePlayerWaiting() {
1685
- var _this11 = this;
1800
+ var _this15 = this;
1686
1801
  if (!!this.inWaitingStart || !this.log.first_frame.timestamp)
1687
1802
  return;
1688
1803
  this.log.stall.timestamp = this.inWaitingStart = this.log.stall.stall_start = getCurrentTime();
@@ -1694,11 +1809,13 @@ var __publicField = (obj, key, value) => {
1694
1809
  this.log.stall.play_current_time = this.player.currentTime;
1695
1810
  this.log.stall_start.buffered = this.getBuffered();
1696
1811
  this.log.stall.buffered = this.log.stall_start.buffered;
1697
- this.log.stall.current_speed = this.getPlayerDownloadSpeed();
1812
+ var _this$getPlayerDownlo = this.getPlayerDownloadSpeed(), speed = _this$getPlayerDownlo.speed, avgSpeed = _this$getPlayerDownlo.avgSpeed;
1813
+ this.log.stall.current_speed = speed;
1814
+ this.log.stall.avg_speed = avgSpeed;
1698
1815
  Object.assign(this.log.stall_start, this.videoSize);
1699
1816
  this.clearStallTimer();
1700
1817
  this.stallStartTimer = setTimeout(function() {
1701
- _this11.logmanager.push(_this11.log.stall_start, true);
1818
+ _this15.logmanager.push(_this15.log.stall_start, true);
1702
1819
  }, 205);
1703
1820
  };
1704
1821
  _proto2.handleVideoseeking = function handleVideoseeking() {
@@ -1769,37 +1886,36 @@ var __publicField = (obj, key, value) => {
1769
1886
  _proto2.handleVideoended = function handleVideoended() {
1770
1887
  this.clearPlayingInterval();
1771
1888
  this.clearStallTimer();
1772
- Object.assign(this.log.playing, _objectSpread2({
1773
- timestamp: getCurrentTime(),
1889
+ Object.assign(this.log.playing, {
1774
1890
  is_last: 1
1775
- }, this.videoSize));
1776
- this.logmanager.push(this.log.playing);
1891
+ });
1892
+ this.reportPlaying();
1777
1893
  };
1778
1894
  _proto2.handleVideoerror = function handleVideoerror() {
1779
- var _this12 = this;
1895
+ var _this16 = this;
1780
1896
  this.errorNumber = 1;
1781
1897
  var error2 = this.player.video.error;
1782
1898
  var firstframeFailed = function firstframeFailed2() {
1783
- if (_this12.log.first_frame.first_frame_view === 0 && !_this12.log.first_frame_failed.code) {
1899
+ if (_this16.log.first_frame.first_frame_view === 0 && !_this16.log.first_frame_failed.code) {
1784
1900
  if (error2) {
1785
- _this12.log.first_frame_failed.code = error2.code;
1786
- _this12.log.first_frame_failed.msg = video_error[error2.code];
1787
- if (_this12.log.first_frame_failed.timestamp !== void 0) {
1788
- _this12.log.first_frame_failed.timestamp = getCurrentTime();
1901
+ _this16.log.first_frame_failed.code = error2.code;
1902
+ _this16.log.first_frame_failed.msg = video_error[error2.code];
1903
+ if (_this16.log.first_frame_failed.timestamp !== void 0) {
1904
+ _this16.log.first_frame_failed.timestamp = getCurrentTime();
1789
1905
  }
1790
- _this12.logmanager.push(_this12.log.first_frame_failed, true);
1791
- if (!_this12.log.play_result.is_threshold) {
1792
- _this12.log.play_result.reason = video_error[error2.code] || "first frame failed";
1793
- _this12.log.play_result.code = error2.code;
1794
- _this12.clearPlayResultTimer();
1795
- _this12.logmanager.push(_this12.log.play_result, true);
1906
+ _this16.logmanager.push(_this16.log.first_frame_failed, true);
1907
+ if (!_this16.log.play_result.is_threshold) {
1908
+ _this16.log.play_result.reason = video_error[error2.code] || "first frame failed";
1909
+ _this16.log.play_result.code = error2.code;
1910
+ _this16.clearPlayResultTimer();
1911
+ _this16.logmanager.push(_this16.log.play_result, true);
1796
1912
  }
1797
1913
  }
1798
1914
  }
1799
- if (_this12.options.error_report_stop) {
1800
- _this12.handleUserLeave();
1915
+ if (_this16.options.error_report_stop) {
1916
+ _this16.handleUserLeave();
1801
1917
  } else {
1802
- _this12.updatePlayStopParams();
1918
+ _this16.updatePlayStopParams();
1803
1919
  }
1804
1920
  };
1805
1921
  Object.assign(this.log.play_error, _objectSpread2(_objectSpread2({
@@ -1820,7 +1936,7 @@ var __publicField = (obj, key, value) => {
1820
1936
  this.player.once("timeupdate", this.handlePlayerPlaying);
1821
1937
  };
1822
1938
  _proto2.destroyFunc = function destroyFunc(no_report_stop) {
1823
- var _this13 = this;
1939
+ var _this17 = this;
1824
1940
  if (this.destroyed) {
1825
1941
  return;
1826
1942
  }
@@ -1834,7 +1950,7 @@ var __publicField = (obj, key, value) => {
1834
1950
  window.removeEventListener("pagehide", this.handleUserLeave);
1835
1951
  }
1836
1952
  videoEvts.forEach(function(name) {
1837
- _this13.removeVideoEvt(name, _this13["handleVideo" + name + "Evt"]);
1953
+ _this17.removeVideoEvt(name, _this17["handleVideo" + name + "Evt"]);
1838
1954
  });
1839
1955
  if (this.player) {
1840
1956
  if (this.player._start) {
@@ -1858,26 +1974,26 @@ var __publicField = (obj, key, value) => {
1858
1974
  this.player.off("bufferappend", this.handleBufferAppend);
1859
1975
  this.player.off("core_event", this.handleCoreEvent);
1860
1976
  this.player.off("degrade", this.handleDegrade);
1861
- this._player = null;
1862
1977
  }
1863
1978
  this.clearPlayingInterval();
1864
1979
  this.clearStallTimer();
1865
1980
  this.clearPlayResultTimer();
1866
1981
  clearTimeout(this.collectDownloadSpeedTimer);
1982
+ this._player = null;
1867
1983
  };
1868
1984
  _proto2.handleUserLeave = function handleUserLeave() {
1869
1985
  try {
1870
- var _this15 = this;
1871
- if (_this15.destroyed || !_this15.started) {
1986
+ var _this19 = this;
1987
+ if (_this19.destroyed || !_this19.started) {
1872
1988
  return Promise.resolve();
1873
1989
  }
1874
- _this15.destroyed = true;
1875
- return Promise.resolve(_this15.updatePlayStopParams()).then(function() {
1876
- _this15.reportPlayStop();
1877
- _this15.clearPlayingInterval();
1878
- _this15.clearStallTimer();
1879
- clearTimeout(_this15.collectDownloadSpeedTimer);
1880
- _this15.removeWindowListener();
1990
+ _this19.destroyed = true;
1991
+ return Promise.resolve(_this19.updatePlayStopParams()).then(function() {
1992
+ _this19.reportPlayStop();
1993
+ _this19.clearPlayingInterval();
1994
+ _this19.clearStallTimer();
1995
+ clearTimeout(_this19.collectDownloadSpeedTimer);
1996
+ _this19.removeWindowListener();
1881
1997
  });
1882
1998
  } catch (e2) {
1883
1999
  return Promise.reject(e2);
@@ -1908,94 +2024,94 @@ var __publicField = (obj, key, value) => {
1908
2024
  this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
1909
2025
  this.saveBuffered();
1910
2026
  }
1911
- this.logmanager.push(this.log.play_stop, true);
2027
+ this.logmanager.push(this.log.play_stop);
1912
2028
  };
1913
2029
  _proto2.reportFirstframe = function reportFirstframe() {
1914
2030
  if (this.firstFrameViewed) {
1915
2031
  return;
1916
2032
  }
1917
2033
  if (this.core && this.core.getStats) {
1918
- var _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
2034
+ var _ref7 = this.core.getStats() || {}, fps = _ref7.fps;
1919
2035
  this.commonParams.fps = fps;
1920
2036
  }
2037
+ var transferCost = this.getTransferCost(true);
1921
2038
  this.firstFrameViewed = true;
1922
2039
  var currentTime = getCurrentTime();
1923
- Object.assign(this.log.first_frame, _objectSpread2({
2040
+ Object.assign(this.log.first_frame, _objectSpread2(_objectSpread2({
1924
2041
  first_frame_view: currentTime - this.log.start_play.start_play_time || currentTime,
1925
2042
  timestamp: currentTime
1926
- }, this.videoSize));
2043
+ }, transferCost), this.videoSize));
1927
2044
  if (this.log.first_frame.ttfb_end) {
1928
2045
  this.log.first_frame.ttdb = currentTime - this.log.first_frame.ttfb_end;
1929
2046
  }
1930
- this.logmanager.push(this.log.first_frame, true);
2047
+ this.logmanager.push(this.log.first_frame);
1931
2048
  this.clearPlayResultTimer();
1932
2049
  this.log.play_result.result = 1;
1933
- this.logmanager.push(this.log.play_result, true);
2050
+ this.logmanager.push(this.log.play_result);
1934
2051
  this.log.play_stop.is_stream_received = 1;
1935
2052
  };
1936
2053
  _proto2.updatePlayStopParams = function updatePlayStopParams() {
1937
2054
  try {
1938
- var _this17$core;
1939
- var _temp9 = function _temp92() {
2055
+ var _this21$core;
2056
+ var _temp13 = function _temp132() {
1940
2057
  Object.assign(play_stop, _objectSpread2({
1941
2058
  timestamp: endTime,
1942
2059
  stop_time: endTime,
1943
- duration: _this17.playedTime / 1e3,
1944
- play_time: _this17.playedTime / 1e3
1945
- }, _this17.videoSize));
1946
- if (_this17.errorNumber === 0) {
1947
- play_stop.play_time_on_no_frame = play_stop.stop_time - _this17.log.start_play.start_play_time;
2060
+ duration: _this21.playedTime / 1e3,
2061
+ play_time: _this21.playedTime / 1e3
2062
+ }, _this21.videoSize));
2063
+ if (_this21.errorNumber === 0) {
2064
+ play_stop.play_time_on_no_frame = play_stop.stop_time - _this21.log.start_play.start_play_time;
1948
2065
  }
1949
2066
  };
1950
- var _this17 = this;
1951
- var timing = getResourceTiming(_this17._url);
2067
+ var _this21 = this;
2068
+ var timing = getResourceTiming(_this21._url);
1952
2069
  var endTime = getCurrentTime();
1953
- _this17.playedTime = endTime - _this17.log.start_play.start_play_time;
1954
- var play_stop = _this17.log.play_stop;
2070
+ _this21.playedTime = endTime - _this21.log.start_play.start_play_time;
2071
+ var play_stop = _this21.log.play_stop;
1955
2072
  Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
1956
2073
  stall_time: 0
1957
2074
  }));
1958
- if (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
1959
- play_stop.stall_time += endTime - _this17.inWaitingStart;
2075
+ if (_this21.inWaitingStart && endTime - _this21.inWaitingStart > 200) {
2076
+ play_stop.stall_time += endTime - _this21.inWaitingStart;
1960
2077
  }
1961
- _this17.inWaitingStart = 0;
2078
+ _this21.inWaitingStart = 0;
1962
2079
  Object.assign(play_stop, _objectSpread2({
1963
- stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
2080
+ stall_time_per_100sec: play_stop.stall_time / _this21.playedTime * 100,
1964
2081
  // 计算百秒卡顿时长
1965
- stall_count_per_100sec: play_stop.stall_count * 1e3 / _this17.playedTime * 100
2082
+ stall_count_per_100sec: play_stop.stall_count * 1e3 / _this21.playedTime * 100
1966
2083
  }, timing));
1967
- if (_this17.log.play_stop.stall_count_per_100sec === 0) {
1968
- _this17.log.play_stop.stall_time_per_100sec = 0;
2084
+ if (_this21.log.play_stop.stall_count_per_100sec === 0) {
2085
+ _this21.log.play_stop.stall_time_per_100sec = 0;
1969
2086
  }
1970
- if (_this17.log.play_stop.stall_time_per_100sec > 100 || _this17.log.play_stop.stall_time_per_100sec < 0) {
2087
+ if (_this21.log.play_stop.stall_time_per_100sec > 100 || _this21.log.play_stop.stall_time_per_100sec < 0) {
1971
2088
  return Promise.resolve();
1972
2089
  }
1973
- if (_this17.log.playing.index) {
1974
- Object.assign(_this17.log.playing, _objectSpread2({
1975
- timestamp: getCurrentTime(),
2090
+ if (_this21.log.playing.index) {
2091
+ Object.assign(_this21.log.playing, {
1976
2092
  is_last: 1
1977
- }, _this17.videoSize));
1978
- _this17.logmanager.push(_this17.log.playing, true);
2093
+ });
2094
+ _this21.reportPlaying();
1979
2095
  } else {
1980
- _this17.log.play_stop.error_code = _this17.log.play_error.code;
1981
- _this17.log.play_stop.error_info = _this17.log.play_error.info;
2096
+ _this21.log.play_stop.error_code = _this21.log.play_error.code;
2097
+ _this21.log.play_stop.error_info = _this21.log.play_error.info;
1982
2098
  }
1983
2099
  endTime = getCurrentTime();
1984
- if ((_this17$core = _this17.core) === null || _this17$core === void 0 ? void 0 : _this17$core.getStats) {
1985
- var _ref7 = _this17.core.getStats() || {}, totalReceivedByte = _ref7.totalReceivedByte, totalReceivedCost = _ref7.totalReceivedCost;
1986
- Object.assign(_this17.log.play_stop, {
2100
+ if ((_this21$core = _this21.core) === null || _this21$core === void 0 ? void 0 : _this21$core.getStats) {
2101
+ var _ref8 = _this21.core.getStats() || {}, totalReceivedByte = _ref8.totalReceivedByte, totalReceivedCost = _ref8.totalReceivedCost;
2102
+ Object.assign(_this21.log.play_stop, {
1987
2103
  totalReceivedByte,
1988
2104
  totalReceivedCost,
1989
2105
  totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
1990
2106
  // bps
1991
2107
  });
1992
2108
  }
1993
- var _temp10 = function() {
1994
- var _this17$core2;
1995
- if ((_this17$core2 = _this17.core) === null || _this17$core2 === void 0 ? void 0 : _this17$core2.getStatsSnapshoot) {
1996
- return Promise.resolve(_this17.core.getStatsSnapshoot()).then(function(_ref8) {
1997
- var video = _ref8.video;
1998
- var _ref9 = video || {}, packetsLost = _ref9.packetsLost, packetsReceived = _ref9.packetsReceived;
2109
+ var _temp14 = function() {
2110
+ var _this21$core2;
2111
+ if ((_this21$core2 = _this21.core) === null || _this21$core2 === void 0 ? void 0 : _this21$core2.getStatsSnapshoot) {
2112
+ return Promise.resolve(_this21.core.getStatsSnapshoot()).then(function(_ref9) {
2113
+ var video = _ref9.video;
2114
+ var _ref10 = video || {}, packetsLost = _ref10.packetsLost, packetsReceived = _ref10.packetsReceived;
1999
2115
  Object.assign(play_stop, {
2000
2116
  packetsLost,
2001
2117
  packetsReceived,
@@ -2004,7 +2120,7 @@ var __publicField = (obj, key, value) => {
2004
2120
  });
2005
2121
  }
2006
2122
  }();
2007
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
2123
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
2008
2124
  } catch (e2) {
2009
2125
  return Promise.reject(e2);
2010
2126
  }
@@ -2803,8 +2919,6 @@ var __publicField = (obj, key, value) => {
2803
2919
  class Logger extends Plugin$2 {
2804
2920
  constructor() {
2805
2921
  super(...arguments);
2806
- __publicField(this, "_userId");
2807
- __publicField(this, "_deviceId");
2808
2922
  __publicField(this, "_liveLogger");
2809
2923
  }
2810
2924
  static get pluginName() {
@@ -2860,8 +2974,8 @@ var __publicField = (obj, key, value) => {
2860
2974
  });
2861
2975
  q.start();
2862
2976
  q.config({
2863
- user_unique_id: this._userId,
2864
- device_id: this._deviceId
2977
+ user_unique_id: this.config.userId,
2978
+ device_id: this.config.deviceId
2865
2979
  });
2866
2980
  }
2867
2981
  _start() {
@@ -2872,14 +2986,14 @@ var __publicField = (obj, key, value) => {
2872
2986
  aid: this.config.appId || 654925,
2873
2987
  project_key: this.config.appId,
2874
2988
  app_name: this.config.appName || this.config.appId,
2875
- user_id: this._userId,
2876
- device_id: this._deviceId,
2989
+ user_id: this.config.userId,
2990
+ device_id: this.config.deviceId,
2877
2991
  error_report_stop: true,
2878
2992
  ext: {
2879
2993
  veplayer_version: "2.3.1-rc.1",
2880
2994
  flv_version: "3.0.21-rc.21",
2881
2995
  hls_version: "3.0.21-rc.21",
2882
- rts_version: "0.2.1-alpha.14"
2996
+ rts_version: "0.2.1-alpha.24"
2883
2997
  }
2884
2998
  });
2885
2999
  }
@@ -4633,6 +4747,12 @@ var __publicField = (obj, key, value) => {
4633
4747
  */
4634
4748
  constructor(options) {
4635
4749
  super(options);
4750
+ /** {en}
4751
+ * @hidden
4752
+ */
4753
+ /** {zh}
4754
+ * @hidden
4755
+ */
4636
4756
  __publicField(this, "_protocolManager");
4637
4757
  }
4638
4758
  /** {zh}
@@ -4743,10 +4863,11 @@ var __publicField = (obj, key, value) => {
4743
4863
  }
4744
4864
  /** {zh}
4745
4865
  * @brief 调用此方法更新 DRM 配置。
4866
+ * @param config DRM 配置对象,包含 Fairplay DRM 的相关设置。
4746
4867
  */
4747
4868
  /** {en}
4748
4869
  * @brief Use this method to update DRM configuration.
4749
- * @param config
4870
+ * @param config A configuration object containing settings for Fairplay DRM.
4750
4871
  */
4751
4872
  updateDrmConfig(config) {
4752
4873
  var _a, _b, _c;
@@ -4824,10 +4945,29 @@ var __publicField = (obj, key, value) => {
4824
4945
  var _a, _b, _c;
4825
4946
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.hls) == null ? void 0 : _c.getStats();
4826
4947
  }
4948
+ /** {en}
4949
+ * @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
4950
+ * @param playlist The playlist, consisting of multiple `Source` type elements.
4951
+ * @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.
4952
+ * @param needUpdateProtocol Whether the protocol needs to be updated.
4953
+ *
4954
+ * - `true`: Forces the protocol update to ensure compatibility with the playback configuration or source.
4955
+ * - `false`: Does not update the protocol and continues to use the current configuration.
4956
+ */
4957
+ /** {zh}
4958
+ * @brief 调用此方法更新播放列表,支持更新源、清晰度等相关信息。
4959
+ * @param playlist 播放列表,包含多个 `Source` 类型的元素。
4960
+ * @param target 可选的目标配置项,可以指定清晰度或源。提供这些信息可以帮助更新特定清晰度或线路的播放源。
4961
+ * @param needUpdateProtocol 是否需要更新协议。
4962
+ * - `true`:强制更新协议,以确保播放配置或源的兼容性。
4963
+ * - `false`:不更新协议,继续使用当前配置。
4964
+ */
4827
4965
  async updatePlaylist(playlist, target, needUpdateProtocol = true) {
4828
4966
  var _a;
4829
4967
  if (needUpdateProtocol) {
4830
- await ((_a = this._protocolManager) == null ? void 0 : _a.update({ playlist }));
4968
+ await ((_a = this._protocolManager) == null ? void 0 : _a.update({
4969
+ playlist
4970
+ }));
4831
4971
  }
4832
4972
  return super.updatePlaylist(playlist, target);
4833
4973
  }
@@ -4863,7 +5003,9 @@ var __publicField = (obj, key, value) => {
4863
5003
  i18nManager: i18n,
4864
5004
  preProcessUrl: (url) => {
4865
5005
  if (isType(".ts", url)) {
4866
- return { url };
5006
+ return {
5007
+ url
5008
+ };
4867
5009
  }
4868
5010
  return {
4869
5011
  url: generateUrlWithSessionId(url)
@@ -4871,7 +5013,9 @@ var __publicField = (obj, key, value) => {
4871
5013
  },
4872
5014
  async preparePlugins(url) {
4873
5015
  if (!protocolManager.enableSelector) {
4874
- await protocolManager.update({ url });
5016
+ await protocolManager.update({
5017
+ url
5018
+ });
4875
5019
  }
4876
5020
  return protocolManager.getStrategy(player, i18n);
4877
5021
  }