@volcengine/veplayer 2.7.0 → 2.7.1-rc.1

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