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

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