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