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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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.2";
14453
14453
  }
14454
14454
  /** {zh}
14455
14455
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -14724,7 +14724,7 @@ class VePlayerBase {
14724
14724
  }
14725
14725
  }
14726
14726
  /** {zh}
14727
- * @brief 调用此方法开始播放 。
14727
+ * @brief 调用此方法开始播放。
14728
14728
  */
14729
14729
  /** {en}
14730
14730
  * @brief Starts playback.
@@ -14970,9 +14970,7 @@ class VePlayerBase {
14970
14970
  if (!url) {
14971
14971
  const transformedError = transform$1(err, this._i18nManager);
14972
14972
  try {
14973
- const { canEmitError } = await this._beforeFallbackError(
14974
- transformedError
14975
- );
14973
+ const { canEmitError } = await this._beforeFallbackError(transformedError);
14976
14974
  if (!canEmitError) {
14977
14975
  return;
14978
14976
  }
@@ -20045,6 +20043,19 @@ function _objectSpread2(target) {
20045
20043
  }
20046
20044
  return target;
20047
20045
  }
20046
+ typeof Symbol !== "undefined" ? Symbol.iterator || (Symbol.iterator = /* @__PURE__ */ Symbol("Symbol.iterator")) : "@@iterator";
20047
+ typeof Symbol !== "undefined" ? Symbol.asyncIterator || (Symbol.asyncIterator = /* @__PURE__ */ Symbol("Symbol.asyncIterator")) : "@@asyncIterator";
20048
+ function _catch(body, recover) {
20049
+ try {
20050
+ var result = body();
20051
+ } catch (e3) {
20052
+ return recover(e3);
20053
+ }
20054
+ if (result && result.then) {
20055
+ return result.then(void 0, recover);
20056
+ }
20057
+ return result;
20058
+ }
20048
20059
  var device_id_key = "xgplayer_device_id";
20049
20060
  var user_id_key = "xgplayer_user_id";
20050
20061
  var getCookie = function getCookie2(key) {
@@ -20248,17 +20259,25 @@ function getPlayerCore(player) {
20248
20259
  return player.plugins.hls;
20249
20260
  } else if (player.plugins.rts) {
20250
20261
  return player.plugins.rts;
20251
- } else if (player.plugins.rtm) {
20252
- return player.plugins.rtm;
20262
+ } else if (player.plugins.flvlive) {
20263
+ return player.plugins.flvlive;
20264
+ } else if (player.plugins.hlslive) {
20265
+ return player.plugins.hlslive;
20266
+ } else if (player.plugins.hlsvod) {
20267
+ return player.plugins.hlsvod;
20268
+ } else if (player.plugins.hlslivemobile) {
20269
+ return player.plugins.hlslivemobile;
20270
+ } else if (player.plugins.flvlivemobile) {
20271
+ return player.plugins.flvlivemobile;
20253
20272
  }
20254
20273
  }
20255
- return null;
20274
+ return player.newHls || player.newFlv || player.__core__ || player.flv;
20256
20275
  }
20257
20276
  function getDefaultOptions(options) {
20258
20277
  return {
20259
20278
  device_id: options.device_id || getDeviceID$1(),
20260
20279
  user_id: options.user_id || getUserId$1(),
20261
- error_report_stop: !!options.error_report_stop,
20280
+ error_report_stop: typeof options.error_report_stop === "boolean" ? options.error_report_stop : true,
20262
20281
  project_key: options.project_key || "live",
20263
20282
  product_line: options.product_line || "live",
20264
20283
  onReport: options.onReport || function() {
@@ -20481,9 +20500,8 @@ function getCommonLog(options) {
20481
20500
  live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
20482
20501
  player_sdk_version: player.version,
20483
20502
  // eslint-disable-next-line no-undef
20484
- logger_version: "1.1.0-alpha.12",
20503
+ logger_version: "1.1.0-alpha.17",
20485
20504
  // 由rollup 在编译时注入
20486
- report_version: "5",
20487
20505
  product_line: options.product_line,
20488
20506
  user_id: options.user_id,
20489
20507
  device_id: options.device_id,
@@ -20492,6 +20510,7 @@ function getCommonLog(options) {
20492
20510
  cdn_ip: options.cdn_ip,
20493
20511
  is_wasm: +(!!mediaType && mediaType !== "video"),
20494
20512
  review_is_live: player.config.isLive ? 2 : 1,
20513
+ isSupportedH265: isCodecSupport("hev1.1.6.L93.B0,mp4a.40.2"),
20495
20514
  aid: options.aid,
20496
20515
  live_id: options.live_id || options.aid + "-" + options.user_id + "-" + Date.now(),
20497
20516
  is_preview: options.is_preview ? 1 : 0,
@@ -20617,6 +20636,7 @@ var Manage = /* @__PURE__ */ function() {
20617
20636
  log.cpu_core_number = cpu_core_number;
20618
20637
  log.memory_usage = memory_usage;
20619
20638
  log.network_downlink = network_downlink;
20639
+ log.muted = +this._player.muted;
20620
20640
  Object.assign(log, _objectSpread2({}, this.videoSize));
20621
20641
  this.send(log);
20622
20642
  };
@@ -20647,14 +20667,29 @@ var getNetStat = function getNetStat2() {
20647
20667
  }
20648
20668
  return "unknown";
20649
20669
  };
20650
- var videoEvts = ["play", "playing", "pause", "ended", "error", "seeking", "seeked", "timeupdate", "waiting", "canplay", "canplaythrough", "durationchange", "ratechange", "volumechange", "loadeddata"];
20670
+ var videoEvts = [
20671
+ "play",
20672
+ "playing",
20673
+ "pause",
20674
+ "ended",
20675
+ // 'error',
20676
+ "seeking",
20677
+ "seeked",
20678
+ "timeupdate",
20679
+ "waiting",
20680
+ "canplay",
20681
+ "canplaythrough",
20682
+ "durationchange",
20683
+ "ratechange",
20684
+ "volumechange",
20685
+ "loadeddata"
20686
+ ];
20651
20687
  var LoggerControl = /* @__PURE__ */ function() {
20652
20688
  function LoggerControl2(options) {
20653
20689
  this.options = options;
20654
20690
  this.logger = new XgLiveLogger(options);
20655
20691
  this.restart = this.restart.bind(this);
20656
20692
  this.bindUrlChange();
20657
- sniffer.browser.includes("Chrome");
20658
20693
  }
20659
20694
  var _proto = LoggerControl2.prototype;
20660
20695
  _proto.restart = function restart(report_stop) {
@@ -20678,6 +20713,9 @@ var LoggerControl = /* @__PURE__ */ function() {
20678
20713
  this.logger.updateExt(ext);
20679
20714
  }
20680
20715
  };
20716
+ _proto.sendLog = function sendLog(log) {
20717
+ this.logger.sendLog(log);
20718
+ };
20681
20719
  _proto.destroy = function destroy2(report_stop) {
20682
20720
  this.logger.destroy(report_stop);
20683
20721
  this.logger = null;
@@ -20739,6 +20777,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
20739
20777
  this.completed = false;
20740
20778
  this.firstFrameViewed = false;
20741
20779
  this.cacheRtcStats = {};
20780
+ this.cachePlaying = {};
20742
20781
  }
20743
20782
  var _proto2 = XgLiveLogger2.prototype;
20744
20783
  _proto2.setNTP = function setNTP(ntp) {
@@ -20828,6 +20867,14 @@ var XgLiveLogger = /* @__PURE__ */ function() {
20828
20867
  });
20829
20868
  }
20830
20869
  };
20870
+ _proto2.sendLog = function sendLog(log) {
20871
+ for (var commonKey in this.commonParams) {
20872
+ if (log[commonKey] === void 0) {
20873
+ log[commonKey] = this["_" + commonKey] || this.commonParams[commonKey];
20874
+ }
20875
+ }
20876
+ this.logmanager.push(log);
20877
+ };
20831
20878
  _proto2.updateExt = function updateExt(ext) {
20832
20879
  for (var logKey in this.log) {
20833
20880
  for (var extKey in ext) {
@@ -20966,9 +21013,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
20966
21013
  };
20967
21014
  };
20968
21015
  _proto2.handleTTFB = function handleTTFB(params) {
20969
- var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed;
21016
+ var _ref = params || {}, end = _ref.end, elapsed = _ref.elapsed, responseUrl = _ref.responseUrl, url = _ref.url;
20970
21017
  this.log.first_frame.ttfb = elapsed || -1;
20971
21018
  this.log.first_frame.ttfb_end = end || 0;
21019
+ this.log.first_frame.is_redirect = +(url !== responseUrl);
21020
+ this.log.play_result.is_redirect = this.log.first_frame.is_redirect;
20972
21021
  };
20973
21022
  _proto2.handleUrlChange = function handleUrlChange(url) {
20974
21023
  this.logmanager.push(Object.assign(this.log.play_url_change, {
@@ -21020,11 +21069,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21020
21069
  this.clearPlayResultTimer();
21021
21070
  this.log.play_result.reason = err.message || "first frame failed";
21022
21071
  this.log.play_result.code = this.log.play_error.code;
21023
- this.logmanager.push(this.log.play_result, true);
21072
+ this.logmanager.push(this.log.play_result);
21024
21073
  }
21025
21074
  }
21026
21075
  if (this.options.error_report_stop) {
21027
- this.handleUserLeave();
21076
+ this.destroy(true);
21028
21077
  } else {
21029
21078
  this.updatePlayStopParams();
21030
21079
  }
@@ -21048,22 +21097,36 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21048
21097
  this.logmanager.push(play_stream_loaded);
21049
21098
  };
21050
21099
  _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
- }
21100
+ try {
21101
+ var _this5 = this;
21102
+ var _this5$log = _this5.log, playing = _this5$log.playing, first_frame = _this5$log.first_frame;
21103
+ var _temp3 = function() {
21104
+ if (sei.code === 100) {
21105
+ var seiString = Utf8ArrayToStr(sei.content);
21106
+ seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
21107
+ var _temp4 = _catch(function() {
21108
+ var seiContent = JSON.parse(seiString);
21109
+ return Promise.resolve(_this5.getPlayerBuffer()).then(function(bufferTime) {
21110
+ var seiDelay = bufferTime + _this5.ntpTime - seiContent.ts;
21111
+ playing.sei_delay = seiDelay;
21112
+ playing.sei_source = seiContent.source;
21113
+ playing.ntp_sync = _this5.options.ntp ? 1 : 0;
21114
+ playing.ntp_delta = _this5.ntp_delta;
21115
+ first_frame.first_sei_delay = seiDelay;
21116
+ first_frame.ntp_sync = _this5.options.ntp ? 1 : 0;
21117
+ first_frame.ntp_delta = _this5.ntp_delta;
21118
+ });
21119
+ }, function() {
21120
+ });
21121
+ if (_temp4 && _temp4.then)
21122
+ return _temp4.then(function() {
21123
+ });
21124
+ }
21125
+ }();
21126
+ return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function() {
21127
+ }) : void 0);
21128
+ } catch (e3) {
21129
+ return Promise.reject(e3);
21067
21130
  }
21068
21131
  };
21069
21132
  _proto2.handleMetaDataLoaded = function handleMetaDataLoaded(type, meta) {
@@ -21093,7 +21156,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21093
21156
  _proto2.handleAVUnsync = function handleAVUnsync(unsyncInfo) {
21094
21157
  Object.assign(this.log.play_av_unsync, unsyncInfo || {});
21095
21158
  this.log.play_av_unsync.timestamp = getCurrentTime();
21096
- this.logmanager.push(this.log.play_av_unsync, false);
21159
+ this.logmanager.push(this.log.play_av_unsync);
21097
21160
  };
21098
21161
  _proto2.handleStreamException = function handleStreamException(info) {
21099
21162
  this.logmanager.push(Object.assign({}, this.log.stream_exception, info));
@@ -21113,27 +21176,58 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21113
21176
  }
21114
21177
  };
21115
21178
  _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
- }
21179
+ try {
21180
+ var _this7 = this;
21181
+ return Promise.resolve(_this7.getRtcStats({
21182
+ onlyJb: true
21183
+ })).then(function(rtc_stats) {
21184
+ if (rtc_stats.video_jb_delay !== void 0) {
21185
+ return rtc_stats.video_jb_delay;
21186
+ }
21187
+ var buffered = _this7.player.video.buffered;
21188
+ if (buffered) {
21189
+ var bufferIdx = Math.max(0, buffered.length - 1);
21190
+ try {
21191
+ var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - _this7.player.video.currentTime) * 1e3);
21192
+ _this7.log.playing.audio_buffer_time = _this7.log.playing.video_buffer_time = bufferedTime;
21193
+ return bufferedTime;
21194
+ } catch (e3) {
21195
+ return 0;
21196
+ }
21197
+ }
21198
+ });
21199
+ } catch (e3) {
21200
+ return Promise.reject(e3);
21126
21201
  }
21127
21202
  };
21203
+ _proto2.getTransferCost = function getTransferCost(isFirstFrame) {
21204
+ var _this$core;
21205
+ if (!((_this$core = this.core) === null || _this$core === void 0 ? void 0 : _this$core.transferCost)) {
21206
+ return {};
21207
+ }
21208
+ if (isFirstFrame)
21209
+ return this.core.transferCost;
21210
+ var _this$core$transferCo = this.core.transferCost, demuxCost = _this$core$transferCo.demuxCost, remuxCost = _this$core$transferCo.remuxCost, appendCost = _this$core$transferCo.appendCost;
21211
+ var transferCost = {
21212
+ demuxCost: demuxCost - this.cachePlaying.demuxCost,
21213
+ remuxCost: remuxCost - this.cachePlaying.remuxCost,
21214
+ appendCost: appendCost - this.cachePlaying.appendCost
21215
+ };
21216
+ Object.assign(this.cachePlaying, this.core.transferCost);
21217
+ return transferCost;
21218
+ };
21128
21219
  _proto2.getPlayerDownloadSpeed = function getPlayerDownloadSpeed() {
21129
21220
  if (this.core && this.core.core) {
21130
21221
  if (typeof this.core.core.speedInfo === "function") {
21131
- return this.core.core.speedInfo().speed;
21222
+ return this.core.core.speedInfo().speed || {};
21132
21223
  }
21133
21224
  }
21225
+ return {};
21134
21226
  };
21135
21227
  _proto2.getPlayerQuality = function getPlayerQuality() {
21136
21228
  var video = this.player.video;
21229
+ if (!video)
21230
+ return;
21137
21231
  if (video.getVideoPlaybackQuality) {
21138
21232
  var quality = video.getVideoPlaybackQuality();
21139
21233
  this.log.playing.drop_count = quality.droppedVideoFrames - this.tempDroppedFrameCount;
@@ -21147,10 +21241,11 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21147
21241
  this.tempDroppedFrameCount = droppedVideoFrames;
21148
21242
  }
21149
21243
  };
21150
- _proto2.getRtcStats = function getRtcStats(duration, first) {
21244
+ _proto2.getRtcStats = function getRtcStats(_ref2) {
21245
+ 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
21246
  try {
21152
- var _this5 = this;
21153
- var rtm = _this5.player.plugins.rts || _this5.player.plugins.rtm;
21247
+ var _this9 = this;
21248
+ var rtm = _this9.player.plugins.rts || _this9.player.plugins.rtm;
21154
21249
  var pc = rtm && rtm.pc;
21155
21250
  var rtc_stats = {};
21156
21251
  if (!pc)
@@ -21161,53 +21256,56 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21161
21256
  switch (type) {
21162
21257
  case "inbound-rtp":
21163
21258
  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;
21259
+ rtc_stats.audio_bytes_received = bytesReceived - (_this9.cacheRtcStats.audioBytesReceived || 0);
21260
+ _this9.cacheRtcStats.audioBytesReceived = bytesReceived;
21261
+ rtc_stats.audio_packets_lost = packetsLost - (_this9.cacheRtcStats.audioPacketsLost || 0);
21262
+ rtc_stats.audio_packets_received = packetsReceived - (_this9.cacheRtcStats.audioPacketsReceived || 0);
21263
+ _this9.cacheRtcStats.audioPacketsLost = packetsLost;
21264
+ _this9.cacheRtcStats.audioPacketsReceived = packetsReceived;
21170
21265
  rtc_stats.audio_level = audioLevel;
21171
21266
  rtc_stats.concealment_event = concealmentEvents;
21172
21267
  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;
21268
+ if (_this9.cacheRtcStats.totalSamplesReceived !== void 0) {
21269
+ rtc_stats.audio_rec_sample_rate = (totalSamplesReceived - _this9.cacheRtcStats.totalSamplesReceived) / duration;
21175
21270
  }
21176
- _this5.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
21271
+ _this9.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
21177
21272
  rtc_stats.concealed_samples = concealedSamples;
21178
21273
  rtc_stats.total_samples_received = totalSamplesReceived;
21179
21274
  } else {
21275
+ rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
21276
+ if (onlyJb) {
21277
+ return rtc_stats;
21278
+ }
21180
21279
  rtc_stats.frames_dropped = framesDropped;
21181
21280
  rtc_stats.iframes_decoded = keyFramesDecoded;
21182
- rtc_stats.video_bytes_received = bytesReceived - (_this5.cacheRtcStats.videoBytesReceived || 0);
21183
- _this5.cacheRtcStats.videoBytesReceived = bytesReceived;
21281
+ rtc_stats.video_bytes_received = bytesReceived - (_this9.cacheRtcStats.videoBytesReceived || 0);
21282
+ _this9.cacheRtcStats.videoBytesReceived = bytesReceived;
21184
21283
  rtc_stats.video_dec_time = totalDecodeTime;
21185
21284
  rtc_stats.video_decoded_delay_ms = rtc_stats.video_dec_elapse / framesDecoded;
21186
21285
  rtc_stats.video_frame_height = frameHeight;
21187
21286
  rtc_stats.video_frame_width = frameWidth;
21188
- if (_this5.cacheRtcStats.framesDecoded !== void 0) {
21189
- rtc_stats.video_decode_framerate = (framesDecoded - _this5.cacheRtcStats.framesDecoded) / duration;
21287
+ if (_this9.cacheRtcStats.framesDecoded !== void 0) {
21288
+ rtc_stats.video_decode_framerate = (framesDecoded - _this9.cacheRtcStats.framesDecoded) / duration;
21190
21289
  }
21191
- _this5.cacheRtcStats.framesDecoded = framesDecoded;
21192
- if (_this5.cacheRtcStats.framesReceived !== void 0) {
21193
- rtc_stats.video_recv_framerate = (framesReceived - _this5.cacheRtcStats.framesReceived) / duration;
21290
+ _this9.cacheRtcStats.framesDecoded = framesDecoded;
21291
+ if (_this9.cacheRtcStats.framesReceived !== void 0) {
21292
+ rtc_stats.video_recv_framerate = (framesReceived - _this9.cacheRtcStats.framesReceived) / duration;
21194
21293
  }
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;
21294
+ if (_this9.cacheRtcStats.freezeCount !== void 0) {
21295
+ rtc_stats.freeze_count = freezeCount - _this9.cacheRtcStats.freezeCount;
21296
+ rtc_stats.freeze_duration = totalFreezesDuration - _this9.cacheRtcStats.totalFreezesDuration;
21198
21297
  }
21199
- _this5.cacheRtcStats.freezeCount = freezeCount;
21200
- _this5.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
21201
- _this5.cacheRtcStats.framesReceived = framesReceived;
21298
+ _this9.cacheRtcStats.freezeCount = freezeCount;
21299
+ _this9.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
21300
+ _this9.cacheRtcStats.framesReceived = framesReceived;
21202
21301
  rtc_stats.total_pauses_duration = totalPausesDuration;
21203
- rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
21204
21302
  rtc_stats.video_jitter = jitter * 1e3;
21205
21303
  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);
21304
+ rtc_stats.video_packets_lost = packetsLost - (_this9.cacheRtcStats.videoPacketsLost || 0);
21305
+ rtc_stats.video_packets_received = packetsReceived - (_this9.cacheRtcStats.videoPacketsReceived || 0);
21208
21306
  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;
21307
+ _this9.cacheRtcStats.videoPacketsLost = packetsLost;
21308
+ _this9.cacheRtcStats.videoPacketsReceived = packetsReceived;
21211
21309
  rtc_stats.video_pli_count = pliCount;
21212
21310
  rtc_stats.decoder_name = decoderImplementation;
21213
21311
  }
@@ -21231,13 +21329,12 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21231
21329
  rtc_stats.audio_codec = mediaType;
21232
21330
  }
21233
21331
  }
21234
- rtc_stats.total_delay = rtc_stats.e2e_delay_ms + (rtc_stats.video_decoded_delay_ms || 0) + (rtc_stats.video_jb_delay || 0);
21235
21332
  });
21236
- Object.assign(_this5.log.playing, {
21333
+ Object.assign(_this9.log.playing, {
21237
21334
  video_download_size: rtc_stats.video_bytes_received,
21238
21335
  decode_fps: rtc_stats.video_decode_framerate,
21239
- sei_delay: rtc_stats.total_delay,
21240
- sei_network_delay: rtc_stats.e2e_delay_ms,
21336
+ // sei_delay: rtc_stats.total_delay,
21337
+ // sei_network_delay: rtc_stats.e2e_delay_ms,
21241
21338
  width: rtc_stats.video_frame_width,
21242
21339
  height: rtc_stats.video_frame_height,
21243
21340
  current_speed: (rtc_stats.audio_bytes_received + rtc_stats.video_bytes_received) / duration
@@ -21250,31 +21347,34 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21250
21347
  };
21251
21348
  _proto2.reportPlaying = function reportPlaying(first) {
21252
21349
  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;
21350
+ var _this11 = this;
21351
+ if (_this11.commonParams.is_wasm) {
21352
+ _this11.commonParams.fps = _this11.player.video.fps;
21353
+ _this11.log.playing.render_fps = _this11.player.video.fps;
21354
+ _this11.log.playing.decode_fps = _this11.player.video.decodeFps;
21258
21355
  }
21259
- _this7.log.playing.index++;
21260
- var lastPlayingTime = _this7.log.playing.timestamp;
21356
+ _this11.log.playing.index++;
21357
+ var lastPlayingTime = _this11.log.playing.timestamp;
21261
21358
  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));
21359
+ if (_this11.inWaitingStart && _this11.inWaitingStart < getCurrentTime()) {
21360
+ stallTime = Math.min(_this11.options.playingInterval || _this11.log.playing.play_time, getCurrentTime() - Math.max(_this11.inWaitingStart, lastPlayingTime));
21264
21361
  }
21265
- _this7.getPlayerQuality();
21266
- _this7.getPlayerBuffer();
21267
- if (!_this7.options.downloadSpeedInterval) {
21268
- _this7.log.playing.current_speed = _this7.getPlayerDownloadSpeed();
21362
+ _this11.getPlayerQuality();
21363
+ _this11.getPlayerBuffer();
21364
+ var transferCost = _this11.getTransferCost(false);
21365
+ if (!_this11.options.downloadSpeedInterval) {
21366
+ var _this11$getPlayerDown = _this11.getPlayerDownloadSpeed(), speed = _this11$getPlayerDown.speed, avgSpeed = _this11$getPlayerDown.avgSpeed;
21367
+ _this11.log.playing.current_speed = speed;
21368
+ _this11.log.playing.avg_speed = avgSpeed;
21269
21369
  }
21270
21370
  var now2 = getCurrentTime();
21271
21371
  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);
21372
+ var stall_time = (stallTime > 200 ? stallTime : 0) + _this11.log.playing.stall_time;
21373
+ var stall_count = (stallTime > 200 ? 1 : 0) + _this11.log.playing.stall_count;
21374
+ if (_this11.options.aggregationDowngradeStallTime) {
21375
+ _this11.log.playing.aggregation_downgrade_stall = (stallTime > _this11.options.aggregationDowngradeStallTime ? stallTime : 0) + (_this11.log.playing.aggregation_downgrade_stall || 0);
21276
21376
  }
21277
- Object.assign(_this7.log.playing, _objectSpread2({
21377
+ Object.assign(_this11.log.playing, _objectSpread2(_objectSpread2({
21278
21378
  timestamp: now2,
21279
21379
  // 60s内存在多次触发playing
21280
21380
  stop_time: now2,
@@ -21286,37 +21386,41 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21286
21386
  stall_count,
21287
21387
  // playing前会有一次卡顿现处于waiting状态
21288
21388
  stall_time,
21289
- play_current_time: _this7.player.currentTime
21290
- }, _this7.videoSize));
21291
- return Promise.resolve(_this7.getRtcStats(playedTime, first)).then(function(stats) {
21389
+ play_current_time: _this11.player.currentTime
21390
+ }, transferCost), _this11.videoSize));
21391
+ return Promise.resolve(_this11.getRtcStats({
21392
+ duration: playedTime,
21393
+ first,
21394
+ onlyJb: false
21395
+ })).then(function(stats) {
21292
21396
  var flvStats = {};
21293
- if (_this7.core) {
21294
- if (_this7.core.getStats) {
21295
- var _ref2 = _this7.core.getStats() || {}, bitrate = _ref2.bitrate, avgSpeed = _ref2.avgSpeed;
21397
+ if (_this11.core) {
21398
+ if (_this11.core.getStats) {
21399
+ var _ref3 = _this11.core.getStats() || {}, bitrate = _ref3.bitrate, _avgSpeed = _ref3.avgSpeed;
21296
21400
  Object.assign(flvStats, {
21297
21401
  bitrate,
21298
- avg_speed: avgSpeed,
21299
- rate: avgSpeed / bitrate
21402
+ avg_speed: _avgSpeed,
21403
+ rate: _avgSpeed / bitrate
21300
21404
  });
21301
21405
  }
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;
21406
+ if (_this11.core.getNetWorkInfo) {
21407
+ var _this11$core$core;
21408
+ var _ref4 = _this11.core.getNetWorkInfo() || {}, lostRate = _ref4.lostRate;
21409
+ var _ref5 = ((_this11$core$core = _this11.core.core) === null || _this11$core$core === void 0 ? void 0 : _this11$core$core._opts) || {}, networkEvaluateInterval = _ref5.networkEvaluateInterval;
21306
21410
  Object.assign(flvStats, {
21307
21411
  lostRate,
21308
21412
  networkEvaluateInterval
21309
21413
  });
21310
21414
  }
21311
21415
  }
21312
- _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
21416
+ _this11.logmanager.push(Object.assign({}, _this11.log.playing, _objectSpread2(_objectSpread2({
21313
21417
  play_time: first ? 0 : playedTime
21314
21418
  }, 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;
21419
+ _this11.log.playing.download_speed_array = [];
21420
+ _this11.log.playing.stall_time = 0;
21421
+ _this11.log.playing.stall_count = 0;
21422
+ if (_this11.options.aggregationDowngradeStallTime) {
21423
+ _this11.log.playing.aggregation_downgrade_stall = 0;
21320
21424
  }
21321
21425
  });
21322
21426
  } catch (e3) {
@@ -21325,64 +21429,71 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21325
21429
  };
21326
21430
  _proto2.handlePlayerPlaying = function handlePlayerPlaying() {
21327
21431
  try {
21328
- var _this9 = this;
21329
- if (_this9.player && _this9.player.video.readyState < 3) {
21432
+ var _this13 = this;
21433
+ if (_this13.player && _this13.player.video.readyState < 3) {
21434
+ return Promise.resolve();
21435
+ }
21436
+ _this13.player.off("playing", _this13.handlePlayerPlaying);
21437
+ _this13.player.off("timeupdate", _this13.handlePlayerPlaying);
21438
+ if (!_this13.player.video) {
21439
+ _this13.destroyFunc();
21440
+ return Promise.resolve();
21441
+ } else if (_this13.player.paused) {
21442
+ _this13.handleVideopause();
21330
21443
  return Promise.resolve();
21331
21444
  }
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;
21445
+ if (_this13.core && _this13.core.getStats) {
21446
+ var _ref6 = _this13.core.getStats() || {}, fps = _ref6.fps;
21447
+ _this13.commonParams.fps = fps;
21337
21448
  }
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() {
21449
+ return Promise.resolve(_this13.reportPlaying(true)).then(function() {
21450
+ _this13.clearPlayingInterval();
21451
+ var timer = _this13.options.playingInterval || _this13.log.playing.play_time;
21452
+ _this13.intervalId = setInterval(function() {
21342
21453
  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();
21454
+ var _temp8 = function() {
21455
+ if (Math.abs(Date.now() - _this13.log.playing.timestamp - timer) < 100 || Date.now() - _this13.log.playing.timestamp >= timer) {
21456
+ var _temp9 = function() {
21457
+ if (!_this13.player || !_this13.player.video) {
21458
+ _this13.destroyFunc();
21348
21459
  } else {
21349
- var _temp6 = function() {
21350
- if (_this9.player.paused) {
21351
- _this9.handleVideopause();
21460
+ var _temp10 = function() {
21461
+ if (_this13.player.paused) {
21462
+ _this13.handleVideopause();
21352
21463
  } else {
21353
- return Promise.resolve(_this9.reportPlaying()).then(function() {
21464
+ return Promise.resolve(_this13.reportPlaying()).then(function() {
21354
21465
  });
21355
21466
  }
21356
21467
  }();
21357
- if (_temp6 && _temp6.then)
21358
- return _temp6.then(function() {
21468
+ if (_temp10 && _temp10.then)
21469
+ return _temp10.then(function() {
21359
21470
  });
21360
21471
  }
21361
21472
  }();
21362
- if (_temp5 && _temp5.then)
21363
- return _temp5.then(function() {
21473
+ if (_temp9 && _temp9.then)
21474
+ return _temp9.then(function() {
21364
21475
  });
21365
21476
  }
21366
21477
  }();
21367
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function() {
21478
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function() {
21368
21479
  }) : void 0);
21369
21480
  } catch (e3) {
21370
21481
  return Promise.reject(e3);
21371
21482
  }
21372
21483
  }, 1e3);
21373
- _this9.clearStallTimer();
21374
- _this9.handleVideoplaying();
21375
- if (!_this9.started) {
21376
- _this9.reportStartPlay();
21484
+ _this13.clearStallTimer();
21485
+ _this13.handleVideoplaying();
21486
+ if (!_this13.started) {
21487
+ _this13.reportStartPlay();
21377
21488
  }
21378
- _this9.saveBuffered();
21489
+ _this13.saveBuffered();
21379
21490
  });
21380
21491
  } catch (e3) {
21381
21492
  return Promise.reject(e3);
21382
21493
  }
21383
21494
  };
21384
21495
  _proto2.handlePlayerReady = function handlePlayerReady() {
21385
- var _this10 = this;
21496
+ var _this14 = this;
21386
21497
  this.log.start_play.start_play_time = getCurrentTime();
21387
21498
  if (this.player.config.autoplay) {
21388
21499
  this.reportStartPlay();
@@ -21393,14 +21504,16 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21393
21504
  this.clearPlayResultTimer();
21394
21505
  this.log.play_result.start = getCurrentTime();
21395
21506
  this.playResultTimer = setTimeout(function() {
21396
- if (_this10.log.play_result.timestamp >= _this10.log.play_result.start)
21507
+ if (_this14.log.play_result.timestamp >= _this14.log.play_result.start)
21508
+ return;
21509
+ if (!_this14.player || _this14.player.paused || !_this14.player.video)
21397
21510
  return;
21398
- _this10.log.play_result.is_threshold = 1;
21399
- _this10.logmanager.push(_this10.log.play_result, true);
21511
+ _this14.log.play_result.is_threshold = 1;
21512
+ _this14.logmanager.push(_this14.log.play_result, true);
21400
21513
  }, this.log.play_result.threshold);
21401
21514
  };
21402
21515
  _proto2.handlePlayerWaiting = function handlePlayerWaiting() {
21403
- var _this11 = this;
21516
+ var _this15 = this;
21404
21517
  if (!!this.inWaitingStart || !this.log.first_frame.timestamp)
21405
21518
  return;
21406
21519
  this.log.stall.timestamp = this.inWaitingStart = this.log.stall.stall_start = getCurrentTime();
@@ -21412,11 +21525,13 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21412
21525
  this.log.stall.play_current_time = this.player.currentTime;
21413
21526
  this.log.stall_start.buffered = this.getBuffered();
21414
21527
  this.log.stall.buffered = this.log.stall_start.buffered;
21415
- this.log.stall.current_speed = this.getPlayerDownloadSpeed();
21528
+ var _this$getPlayerDownlo = this.getPlayerDownloadSpeed(), speed = _this$getPlayerDownlo.speed, avgSpeed = _this$getPlayerDownlo.avgSpeed;
21529
+ this.log.stall.current_speed = speed;
21530
+ this.log.stall.avg_speed = avgSpeed;
21416
21531
  Object.assign(this.log.stall_start, this.videoSize);
21417
21532
  this.clearStallTimer();
21418
21533
  this.stallStartTimer = setTimeout(function() {
21419
- _this11.logmanager.push(_this11.log.stall_start, true);
21534
+ _this15.logmanager.push(_this15.log.stall_start, true);
21420
21535
  }, 205);
21421
21536
  };
21422
21537
  _proto2.handleVideoseeking = function handleVideoseeking() {
@@ -21487,37 +21602,36 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21487
21602
  _proto2.handleVideoended = function handleVideoended() {
21488
21603
  this.clearPlayingInterval();
21489
21604
  this.clearStallTimer();
21490
- Object.assign(this.log.playing, _objectSpread2({
21491
- timestamp: getCurrentTime(),
21605
+ Object.assign(this.log.playing, {
21492
21606
  is_last: 1
21493
- }, this.videoSize));
21494
- this.logmanager.push(this.log.playing);
21607
+ });
21608
+ this.reportPlaying();
21495
21609
  };
21496
21610
  _proto2.handleVideoerror = function handleVideoerror() {
21497
- var _this12 = this;
21611
+ var _this16 = this;
21498
21612
  this.errorNumber = 1;
21499
21613
  var error2 = this.player.video.error;
21500
21614
  var firstframeFailed = function firstframeFailed2() {
21501
- if (_this12.log.first_frame.first_frame_view === 0 && !_this12.log.first_frame_failed.code) {
21615
+ if (_this16.log.first_frame.first_frame_view === 0 && !_this16.log.first_frame_failed.code) {
21502
21616
  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();
21617
+ _this16.log.first_frame_failed.code = error2.code;
21618
+ _this16.log.first_frame_failed.msg = video_error[error2.code];
21619
+ if (_this16.log.first_frame_failed.timestamp !== void 0) {
21620
+ _this16.log.first_frame_failed.timestamp = getCurrentTime();
21507
21621
  }
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);
21622
+ _this16.logmanager.push(_this16.log.first_frame_failed, true);
21623
+ if (!_this16.log.play_result.is_threshold) {
21624
+ _this16.log.play_result.reason = video_error[error2.code] || "first frame failed";
21625
+ _this16.log.play_result.code = error2.code;
21626
+ _this16.clearPlayResultTimer();
21627
+ _this16.logmanager.push(_this16.log.play_result, true);
21514
21628
  }
21515
21629
  }
21516
21630
  }
21517
- if (_this12.options.error_report_stop) {
21518
- _this12.handleUserLeave();
21631
+ if (_this16.options.error_report_stop) {
21632
+ _this16.handleUserLeave();
21519
21633
  } else {
21520
- _this12.updatePlayStopParams();
21634
+ _this16.updatePlayStopParams();
21521
21635
  }
21522
21636
  };
21523
21637
  Object.assign(this.log.play_error, _objectSpread2(_objectSpread2({
@@ -21538,7 +21652,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21538
21652
  this.player.once("timeupdate", this.handlePlayerPlaying);
21539
21653
  };
21540
21654
  _proto2.destroyFunc = function destroyFunc(no_report_stop) {
21541
- var _this13 = this;
21655
+ var _this17 = this;
21542
21656
  if (this.destroyed) {
21543
21657
  return;
21544
21658
  }
@@ -21552,7 +21666,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21552
21666
  window.removeEventListener("pagehide", this.handleUserLeave);
21553
21667
  }
21554
21668
  videoEvts.forEach(function(name) {
21555
- _this13.removeVideoEvt(name, _this13["handleVideo" + name + "Evt"]);
21669
+ _this17.removeVideoEvt(name, _this17["handleVideo" + name + "Evt"]);
21556
21670
  });
21557
21671
  if (this.player) {
21558
21672
  if (this.player._start) {
@@ -21576,26 +21690,26 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21576
21690
  this.player.off("bufferappend", this.handleBufferAppend);
21577
21691
  this.player.off("core_event", this.handleCoreEvent);
21578
21692
  this.player.off("degrade", this.handleDegrade);
21579
- this._player = null;
21580
21693
  }
21581
21694
  this.clearPlayingInterval();
21582
21695
  this.clearStallTimer();
21583
21696
  this.clearPlayResultTimer();
21584
21697
  clearTimeout(this.collectDownloadSpeedTimer);
21698
+ this._player = null;
21585
21699
  };
21586
21700
  _proto2.handleUserLeave = function handleUserLeave() {
21587
21701
  try {
21588
- var _this15 = this;
21589
- if (_this15.destroyed || !_this15.started) {
21702
+ var _this19 = this;
21703
+ if (_this19.destroyed || !_this19.started) {
21590
21704
  return Promise.resolve();
21591
21705
  }
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();
21706
+ _this19.destroyed = true;
21707
+ return Promise.resolve(_this19.updatePlayStopParams()).then(function() {
21708
+ _this19.reportPlayStop();
21709
+ _this19.clearPlayingInterval();
21710
+ _this19.clearStallTimer();
21711
+ clearTimeout(_this19.collectDownloadSpeedTimer);
21712
+ _this19.removeWindowListener();
21599
21713
  });
21600
21714
  } catch (e3) {
21601
21715
  return Promise.reject(e3);
@@ -21626,94 +21740,94 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21626
21740
  this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
21627
21741
  this.saveBuffered();
21628
21742
  }
21629
- this.logmanager.push(this.log.play_stop, true);
21743
+ this.logmanager.push(this.log.play_stop);
21630
21744
  };
21631
21745
  _proto2.reportFirstframe = function reportFirstframe() {
21632
21746
  if (this.firstFrameViewed) {
21633
21747
  return;
21634
21748
  }
21635
21749
  if (this.core && this.core.getStats) {
21636
- var _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
21750
+ var _ref7 = this.core.getStats() || {}, fps = _ref7.fps;
21637
21751
  this.commonParams.fps = fps;
21638
21752
  }
21753
+ var transferCost = this.getTransferCost(true);
21639
21754
  this.firstFrameViewed = true;
21640
21755
  var currentTime = getCurrentTime();
21641
- Object.assign(this.log.first_frame, _objectSpread2({
21756
+ Object.assign(this.log.first_frame, _objectSpread2(_objectSpread2({
21642
21757
  first_frame_view: currentTime - this.log.start_play.start_play_time || currentTime,
21643
21758
  timestamp: currentTime
21644
- }, this.videoSize));
21759
+ }, transferCost), this.videoSize));
21645
21760
  if (this.log.first_frame.ttfb_end) {
21646
21761
  this.log.first_frame.ttdb = currentTime - this.log.first_frame.ttfb_end;
21647
21762
  }
21648
- this.logmanager.push(this.log.first_frame, true);
21763
+ this.logmanager.push(this.log.first_frame);
21649
21764
  this.clearPlayResultTimer();
21650
21765
  this.log.play_result.result = 1;
21651
- this.logmanager.push(this.log.play_result, true);
21766
+ this.logmanager.push(this.log.play_result);
21652
21767
  this.log.play_stop.is_stream_received = 1;
21653
21768
  };
21654
21769
  _proto2.updatePlayStopParams = function updatePlayStopParams() {
21655
21770
  try {
21656
- var _this17$core;
21657
- var _temp9 = function _temp92() {
21771
+ var _this21$core;
21772
+ var _temp13 = function _temp132() {
21658
21773
  Object.assign(play_stop, _objectSpread2({
21659
21774
  timestamp: endTime,
21660
21775
  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;
21776
+ duration: _this21.playedTime / 1e3,
21777
+ play_time: _this21.playedTime / 1e3
21778
+ }, _this21.videoSize));
21779
+ if (_this21.errorNumber === 0) {
21780
+ play_stop.play_time_on_no_frame = play_stop.stop_time - _this21.log.start_play.start_play_time;
21666
21781
  }
21667
21782
  };
21668
- var _this17 = this;
21669
- var timing = getResourceTiming(_this17._url);
21783
+ var _this21 = this;
21784
+ var timing = getResourceTiming(_this21._url);
21670
21785
  var endTime = getCurrentTime();
21671
- _this17.playedTime = endTime - _this17.log.start_play.start_play_time;
21672
- var play_stop = _this17.log.play_stop;
21786
+ _this21.playedTime = endTime - _this21.log.start_play.start_play_time;
21787
+ var play_stop = _this21.log.play_stop;
21673
21788
  Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
21674
21789
  stall_time: 0
21675
21790
  }));
21676
- if (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
21677
- play_stop.stall_time += endTime - _this17.inWaitingStart;
21791
+ if (_this21.inWaitingStart && endTime - _this21.inWaitingStart > 200) {
21792
+ play_stop.stall_time += endTime - _this21.inWaitingStart;
21678
21793
  }
21679
- _this17.inWaitingStart = 0;
21794
+ _this21.inWaitingStart = 0;
21680
21795
  Object.assign(play_stop, _objectSpread2({
21681
- stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
21796
+ stall_time_per_100sec: play_stop.stall_time / _this21.playedTime * 100,
21682
21797
  // 计算百秒卡顿时长
21683
- stall_count_per_100sec: play_stop.stall_count * 1e3 / _this17.playedTime * 100
21798
+ stall_count_per_100sec: play_stop.stall_count * 1e3 / _this21.playedTime * 100
21684
21799
  }, timing));
21685
- if (_this17.log.play_stop.stall_count_per_100sec === 0) {
21686
- _this17.log.play_stop.stall_time_per_100sec = 0;
21800
+ if (_this21.log.play_stop.stall_count_per_100sec === 0) {
21801
+ _this21.log.play_stop.stall_time_per_100sec = 0;
21687
21802
  }
21688
- if (_this17.log.play_stop.stall_time_per_100sec > 100 || _this17.log.play_stop.stall_time_per_100sec < 0) {
21803
+ if (_this21.log.play_stop.stall_time_per_100sec > 100 || _this21.log.play_stop.stall_time_per_100sec < 0) {
21689
21804
  return Promise.resolve();
21690
21805
  }
21691
- if (_this17.log.playing.index) {
21692
- Object.assign(_this17.log.playing, _objectSpread2({
21693
- timestamp: getCurrentTime(),
21806
+ if (_this21.log.playing.index) {
21807
+ Object.assign(_this21.log.playing, {
21694
21808
  is_last: 1
21695
- }, _this17.videoSize));
21696
- _this17.logmanager.push(_this17.log.playing, true);
21809
+ });
21810
+ _this21.reportPlaying();
21697
21811
  } 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;
21812
+ _this21.log.play_stop.error_code = _this21.log.play_error.code;
21813
+ _this21.log.play_stop.error_info = _this21.log.play_error.info;
21700
21814
  }
21701
21815
  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, {
21816
+ if ((_this21$core = _this21.core) === null || _this21$core === void 0 ? void 0 : _this21$core.getStats) {
21817
+ var _ref8 = _this21.core.getStats() || {}, totalReceivedByte = _ref8.totalReceivedByte, totalReceivedCost = _ref8.totalReceivedCost;
21818
+ Object.assign(_this21.log.play_stop, {
21705
21819
  totalReceivedByte,
21706
21820
  totalReceivedCost,
21707
21821
  totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
21708
21822
  // bps
21709
21823
  });
21710
21824
  }
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;
21825
+ var _temp14 = function() {
21826
+ var _this21$core2;
21827
+ if ((_this21$core2 = _this21.core) === null || _this21$core2 === void 0 ? void 0 : _this21$core2.getStatsSnapshoot) {
21828
+ return Promise.resolve(_this21.core.getStatsSnapshoot()).then(function(_ref9) {
21829
+ var video = _ref9.video;
21830
+ var _ref10 = video || {}, packetsLost = _ref10.packetsLost, packetsReceived = _ref10.packetsReceived;
21717
21831
  Object.assign(play_stop, {
21718
21832
  packetsLost,
21719
21833
  packetsReceived,
@@ -21722,7 +21836,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
21722
21836
  });
21723
21837
  }
21724
21838
  }();
21725
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
21839
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
21726
21840
  } catch (e3) {
21727
21841
  return Promise.reject(e3);
21728
21842
  }
@@ -22519,8 +22633,6 @@ const generateSessionId = () => {
22519
22633
  class Logger extends Plugin {
22520
22634
  constructor() {
22521
22635
  super(...arguments);
22522
- __publicField(this, "_userId");
22523
- __publicField(this, "_deviceId");
22524
22636
  __publicField(this, "_liveLogger");
22525
22637
  }
22526
22638
  static get pluginName() {
@@ -22576,8 +22688,8 @@ class Logger extends Plugin {
22576
22688
  });
22577
22689
  q.start();
22578
22690
  q.config({
22579
- user_unique_id: this._userId,
22580
- device_id: this._deviceId
22691
+ user_unique_id: this.config.userId,
22692
+ device_id: this.config.deviceId
22581
22693
  });
22582
22694
  }
22583
22695
  _start() {
@@ -22588,14 +22700,14 @@ class Logger extends Plugin {
22588
22700
  aid: this.config.appId || 654925,
22589
22701
  project_key: this.config.appId,
22590
22702
  app_name: this.config.appName || this.config.appId,
22591
- user_id: this._userId,
22592
- device_id: this._deviceId,
22703
+ user_id: this.config.userId,
22704
+ device_id: this.config.deviceId,
22593
22705
  error_report_stop: true,
22594
22706
  ext: {
22595
- veplayer_version: "2.7.1-rc.0",
22707
+ veplayer_version: "2.7.1-rc.2",
22596
22708
  flv_version: "3.0.21-rc.21",
22597
22709
  hls_version: "3.0.21-rc.21",
22598
- rts_version: "0.2.1-alpha.14"
22710
+ rts_version: "0.2.1-alpha.24"
22599
22711
  }
22600
22712
  });
22601
22713
  }
@@ -23784,6 +23896,12 @@ class VePlayerLive extends VePlayerBase {
23784
23896
  */
23785
23897
  constructor(options) {
23786
23898
  super(options);
23899
+ /** {en}
23900
+ * @hidden
23901
+ */
23902
+ /** {zh}
23903
+ * @hidden
23904
+ */
23787
23905
  __publicField(this, "_protocolManager");
23788
23906
  }
23789
23907
  /** {zh}
@@ -23894,10 +24012,11 @@ class VePlayerLive extends VePlayerBase {
23894
24012
  }
23895
24013
  /** {zh}
23896
24014
  * @brief 调用此方法更新 DRM 配置。
24015
+ * @param config DRM 配置对象,包含 Fairplay DRM 的相关设置。
23897
24016
  */
23898
24017
  /** {en}
23899
24018
  * @brief Use this method to update DRM configuration.
23900
- * @param config
24019
+ * @param config A configuration object containing settings for Fairplay DRM.
23901
24020
  */
23902
24021
  updateDrmConfig(config) {
23903
24022
  var _a, _b, _c;
@@ -23975,10 +24094,29 @@ class VePlayerLive extends VePlayerBase {
23975
24094
  var _a, _b, _c;
23976
24095
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.hls) == null ? void 0 : _c.getStats();
23977
24096
  }
24097
+ /** {en}
24098
+ * @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
24099
+ * @param playlist The playlist, consisting of multiple `Source` type elements.
24100
+ * @param target An optional target configuration, which can specify the resolution or source. Providing this information helps update the playback source for a specific resolution or stream.
24101
+ * @param needUpdateProtocol Whether the protocol needs to be updated.
24102
+ *
24103
+ * - `true`: Forces the protocol update to ensure compatibility with the playback configuration or source.
24104
+ * - `false`: Does not update the protocol and continues to use the current configuration.
24105
+ */
24106
+ /** {zh}
24107
+ * @brief 调用此方法更新播放列表,支持更新源、清晰度等相关信息。
24108
+ * @param playlist 播放列表,包含多个 `Source` 类型的元素。
24109
+ * @param target 可选的目标配置项,可以指定清晰度或源。提供这些信息可以帮助更新特定清晰度或线路的播放源。
24110
+ * @param needUpdateProtocol 是否需要更新协议。
24111
+ * - `true`:强制更新协议,以确保播放配置或源的兼容性。
24112
+ * - `false`:不更新协议,继续使用当前配置。
24113
+ */
23978
24114
  async updatePlaylist(playlist, target, needUpdateProtocol = true) {
23979
24115
  var _a;
23980
24116
  if (needUpdateProtocol) {
23981
- await ((_a = this._protocolManager) == null ? void 0 : _a.update({ playlist }));
24117
+ await ((_a = this._protocolManager) == null ? void 0 : _a.update({
24118
+ playlist
24119
+ }));
23982
24120
  }
23983
24121
  return super.updatePlaylist(playlist, target);
23984
24122
  }
@@ -24014,7 +24152,9 @@ async function createLivePlayer(options) {
24014
24152
  i18nManager: i18n,
24015
24153
  preProcessUrl: (url) => {
24016
24154
  if (isType(".ts", url)) {
24017
- return { url };
24155
+ return {
24156
+ url
24157
+ };
24018
24158
  }
24019
24159
  return {
24020
24160
  url: generateUrlWithSessionId(url)
@@ -24022,7 +24162,9 @@ async function createLivePlayer(options) {
24022
24162
  },
24023
24163
  async preparePlugins(url) {
24024
24164
  if (!protocolManager.enableSelector) {
24025
- await protocolManager.update({ url });
24165
+ await protocolManager.update({
24166
+ url
24167
+ });
24026
24168
  }
24027
24169
  return protocolManager.getStrategy(player, i18n);
24028
24170
  }