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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14453,7 +14453,7 @@ var __publicField = (obj, key, value) => {
14453
14453
  * @brief Retrieve the player SDK version number.
14454
14454
  */
14455
14455
  get playerVersion() {
14456
- return "2.7.1-rc.0";
14456
+ return "2.7.1-rc.1";
14457
14457
  }
14458
14458
  /** {zh}
14459
14459
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -20049,6 +20049,19 @@ var __publicField = (obj, key, value) => {
20049
20049
  }
20050
20050
  return target;
20051
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
+ }
20052
20065
  var device_id_key = "xgplayer_device_id";
20053
20066
  var user_id_key = "xgplayer_user_id";
20054
20067
  var getCookie = function getCookie2(key) {
@@ -20252,17 +20265,25 @@ var __publicField = (obj, key, value) => {
20252
20265
  return player.plugins.hls;
20253
20266
  } else if (player.plugins.rts) {
20254
20267
  return player.plugins.rts;
20255
- } else if (player.plugins.rtm) {
20256
- 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;
20257
20278
  }
20258
20279
  }
20259
- return null;
20280
+ return player.newHls || player.newFlv || player.__core__ || player.flv;
20260
20281
  }
20261
20282
  function getDefaultOptions(options) {
20262
20283
  return {
20263
20284
  device_id: options.device_id || getDeviceID$1(),
20264
20285
  user_id: options.user_id || getUserId$1(),
20265
- error_report_stop: !!options.error_report_stop,
20286
+ error_report_stop: typeof options.error_report_stop === "boolean" ? options.error_report_stop : true,
20266
20287
  project_key: options.project_key || "live",
20267
20288
  product_line: options.product_line || "live",
20268
20289
  onReport: options.onReport || function() {
@@ -20485,9 +20506,8 @@ var __publicField = (obj, key, value) => {
20485
20506
  live_sdk_version: getPlayerCore(player) || player.hlsOps ? "2" : "-1",
20486
20507
  player_sdk_version: player.version,
20487
20508
  // eslint-disable-next-line no-undef
20488
- logger_version: "1.1.0-alpha.12",
20509
+ logger_version: "1.1.0-alpha.17",
20489
20510
  // 由rollup 在编译时注入
20490
- report_version: "5",
20491
20511
  product_line: options.product_line,
20492
20512
  user_id: options.user_id,
20493
20513
  device_id: options.device_id,
@@ -20496,6 +20516,7 @@ var __publicField = (obj, key, value) => {
20496
20516
  cdn_ip: options.cdn_ip,
20497
20517
  is_wasm: +(!!mediaType && mediaType !== "video"),
20498
20518
  review_is_live: player.config.isLive ? 2 : 1,
20519
+ isSupportedH265: isCodecSupport("hev1.1.6.L93.B0,mp4a.40.2"),
20499
20520
  aid: options.aid,
20500
20521
  live_id: options.live_id || options.aid + "-" + options.user_id + "-" + Date.now(),
20501
20522
  is_preview: options.is_preview ? 1 : 0,
@@ -20621,6 +20642,7 @@ var __publicField = (obj, key, value) => {
20621
20642
  log.cpu_core_number = cpu_core_number;
20622
20643
  log.memory_usage = memory_usage;
20623
20644
  log.network_downlink = network_downlink;
20645
+ log.muted = +this._player.muted;
20624
20646
  Object.assign(log, _objectSpread2({}, this.videoSize));
20625
20647
  this.send(log);
20626
20648
  };
@@ -20651,14 +20673,29 @@ var __publicField = (obj, key, value) => {
20651
20673
  }
20652
20674
  return "unknown";
20653
20675
  };
20654
- 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
+ ];
20655
20693
  var LoggerControl = /* @__PURE__ */ function() {
20656
20694
  function LoggerControl2(options) {
20657
20695
  this.options = options;
20658
20696
  this.logger = new XgLiveLogger(options);
20659
20697
  this.restart = this.restart.bind(this);
20660
20698
  this.bindUrlChange();
20661
- sniffer.browser.includes("Chrome");
20662
20699
  }
20663
20700
  var _proto = LoggerControl2.prototype;
20664
20701
  _proto.restart = function restart(report_stop) {
@@ -20682,6 +20719,9 @@ var __publicField = (obj, key, value) => {
20682
20719
  this.logger.updateExt(ext);
20683
20720
  }
20684
20721
  };
20722
+ _proto.sendLog = function sendLog(log) {
20723
+ this.logger.sendLog(log);
20724
+ };
20685
20725
  _proto.destroy = function destroy(report_stop) {
20686
20726
  this.logger.destroy(report_stop);
20687
20727
  this.logger = null;
@@ -20743,6 +20783,7 @@ var __publicField = (obj, key, value) => {
20743
20783
  this.completed = false;
20744
20784
  this.firstFrameViewed = false;
20745
20785
  this.cacheRtcStats = {};
20786
+ this.cachePlaying = {};
20746
20787
  }
20747
20788
  var _proto2 = XgLiveLogger2.prototype;
20748
20789
  _proto2.setNTP = function setNTP(ntp) {
@@ -20832,6 +20873,14 @@ var __publicField = (obj, key, value) => {
20832
20873
  });
20833
20874
  }
20834
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
+ };
20835
20884
  _proto2.updateExt = function updateExt(ext) {
20836
20885
  for (var logKey in this.log) {
20837
20886
  for (var extKey in ext) {
@@ -20970,9 +21019,11 @@ var __publicField = (obj, key, value) => {
20970
21019
  };
20971
21020
  };
20972
21021
  _proto2.handleTTFB = function handleTTFB(params) {
20973
- 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;
20974
21023
  this.log.first_frame.ttfb = elapsed || -1;
20975
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;
20976
21027
  };
20977
21028
  _proto2.handleUrlChange = function handleUrlChange(url) {
20978
21029
  this.logmanager.push(Object.assign(this.log.play_url_change, {
@@ -21024,11 +21075,11 @@ var __publicField = (obj, key, value) => {
21024
21075
  this.clearPlayResultTimer();
21025
21076
  this.log.play_result.reason = err.message || "first frame failed";
21026
21077
  this.log.play_result.code = this.log.play_error.code;
21027
- this.logmanager.push(this.log.play_result, true);
21078
+ this.logmanager.push(this.log.play_result);
21028
21079
  }
21029
21080
  }
21030
21081
  if (this.options.error_report_stop) {
21031
- this.handleUserLeave();
21082
+ this.destroy(true);
21032
21083
  } else {
21033
21084
  this.updatePlayStopParams();
21034
21085
  }
@@ -21052,22 +21103,36 @@ var __publicField = (obj, key, value) => {
21052
21103
  this.logmanager.push(play_stream_loaded);
21053
21104
  };
21054
21105
  _proto2.handleSEIParsed = function handleSEIParsed(sei) {
21055
- var _this$log = this.log, playing = _this$log.playing, first_frame = _this$log.first_frame;
21056
- if (sei.code === 100) {
21057
- var seiString = Utf8ArrayToStr(sei.content);
21058
- seiString = seiString.slice(seiString.indexOf("{"), seiString.lastIndexOf("}") + 1);
21059
- try {
21060
- var seiContent = JSON.parse(seiString);
21061
- var seiDelay = this.getPlayerBuffer() + this.ntpTime - seiContent.ts;
21062
- playing.sei_delay = seiDelay;
21063
- playing.sei_source = seiContent.source;
21064
- playing.ntp_sync = this.options.ntp ? 1 : 0;
21065
- playing.ntp_delta = this.ntp_delta;
21066
- first_frame.first_sei_delay = seiDelay;
21067
- first_frame.ntp_sync = this.options.ntp ? 1 : 0;
21068
- first_frame.ntp_delta = this.ntp_delta;
21069
- } catch (e2) {
21070
- }
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);
21071
21136
  }
21072
21137
  };
21073
21138
  _proto2.handleMetaDataLoaded = function handleMetaDataLoaded(type, meta) {
@@ -21097,7 +21162,7 @@ var __publicField = (obj, key, value) => {
21097
21162
  _proto2.handleAVUnsync = function handleAVUnsync(unsyncInfo) {
21098
21163
  Object.assign(this.log.play_av_unsync, unsyncInfo || {});
21099
21164
  this.log.play_av_unsync.timestamp = getCurrentTime();
21100
- this.logmanager.push(this.log.play_av_unsync, false);
21165
+ this.logmanager.push(this.log.play_av_unsync);
21101
21166
  };
21102
21167
  _proto2.handleStreamException = function handleStreamException(info) {
21103
21168
  this.logmanager.push(Object.assign({}, this.log.stream_exception, info));
@@ -21117,27 +21182,58 @@ var __publicField = (obj, key, value) => {
21117
21182
  }
21118
21183
  };
21119
21184
  _proto2.getPlayerBuffer = function getPlayerBuffer() {
21120
- var buffered = this.player.video.buffered;
21121
- if (buffered) {
21122
- var bufferIdx = Math.max(0, buffered.length - 1);
21123
- try {
21124
- var bufferedTime = Number.parseInt((buffered.end(bufferIdx) - this.player.video.currentTime) * 1e3);
21125
- this.log.playing.audio_buffer_time = this.log.playing.video_buffer_time = bufferedTime;
21126
- return bufferedTime;
21127
- } catch (e2) {
21128
- return 0;
21129
- }
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);
21130
21207
  }
21131
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
+ };
21132
21225
  _proto2.getPlayerDownloadSpeed = function getPlayerDownloadSpeed() {
21133
21226
  if (this.core && this.core.core) {
21134
21227
  if (typeof this.core.core.speedInfo === "function") {
21135
- return this.core.core.speedInfo().speed;
21228
+ return this.core.core.speedInfo().speed || {};
21136
21229
  }
21137
21230
  }
21231
+ return {};
21138
21232
  };
21139
21233
  _proto2.getPlayerQuality = function getPlayerQuality() {
21140
21234
  var video = this.player.video;
21235
+ if (!video)
21236
+ return;
21141
21237
  if (video.getVideoPlaybackQuality) {
21142
21238
  var quality = video.getVideoPlaybackQuality();
21143
21239
  this.log.playing.drop_count = quality.droppedVideoFrames - this.tempDroppedFrameCount;
@@ -21151,10 +21247,11 @@ var __publicField = (obj, key, value) => {
21151
21247
  this.tempDroppedFrameCount = droppedVideoFrames;
21152
21248
  }
21153
21249
  };
21154
- _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;
21155
21252
  try {
21156
- var _this5 = this;
21157
- 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;
21158
21255
  var pc = rtm && rtm.pc;
21159
21256
  var rtc_stats = {};
21160
21257
  if (!pc)
@@ -21165,53 +21262,56 @@ var __publicField = (obj, key, value) => {
21165
21262
  switch (type) {
21166
21263
  case "inbound-rtp":
21167
21264
  if (mediaType === "audio") {
21168
- rtc_stats.audio_bytes_received = bytesReceived - (_this5.cacheRtcStats.audioBytesReceived || 0);
21169
- _this5.cacheRtcStats.audioBytesReceived = bytesReceived;
21170
- rtc_stats.audio_packets_lost = packetsLost - (_this5.cacheRtcStats.audioPacketsLost || 0);
21171
- rtc_stats.audio_packets_received = packetsReceived - (_this5.cacheRtcStats.audioPacketsReceived || 0);
21172
- _this5.cacheRtcStats.audioPacketsLost = packetsLost;
21173
- _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;
21174
21271
  rtc_stats.audio_level = audioLevel;
21175
21272
  rtc_stats.concealment_event = concealmentEvents;
21176
21273
  rtc_stats.audio_fraction_lost = rtc_stats.audio_packets_lost / rtc_stats.audio_packets_received;
21177
- if (_this5.cacheRtcStats.totalSamplesReceived !== void 0) {
21178
- 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;
21179
21276
  }
21180
- _this5.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
21277
+ _this9.cacheRtcStats.totalSamplesReceived = totalSamplesReceived;
21181
21278
  rtc_stats.concealed_samples = concealedSamples;
21182
21279
  rtc_stats.total_samples_received = totalSamplesReceived;
21183
21280
  } else {
21281
+ rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
21282
+ if (onlyJb) {
21283
+ return rtc_stats;
21284
+ }
21184
21285
  rtc_stats.frames_dropped = framesDropped;
21185
21286
  rtc_stats.iframes_decoded = keyFramesDecoded;
21186
- rtc_stats.video_bytes_received = bytesReceived - (_this5.cacheRtcStats.videoBytesReceived || 0);
21187
- _this5.cacheRtcStats.videoBytesReceived = bytesReceived;
21287
+ rtc_stats.video_bytes_received = bytesReceived - (_this9.cacheRtcStats.videoBytesReceived || 0);
21288
+ _this9.cacheRtcStats.videoBytesReceived = bytesReceived;
21188
21289
  rtc_stats.video_dec_time = totalDecodeTime;
21189
21290
  rtc_stats.video_decoded_delay_ms = rtc_stats.video_dec_elapse / framesDecoded;
21190
21291
  rtc_stats.video_frame_height = frameHeight;
21191
21292
  rtc_stats.video_frame_width = frameWidth;
21192
- if (_this5.cacheRtcStats.framesDecoded !== void 0) {
21193
- 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;
21194
21295
  }
21195
- _this5.cacheRtcStats.framesDecoded = framesDecoded;
21196
- if (_this5.cacheRtcStats.framesReceived !== void 0) {
21197
- 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;
21198
21299
  }
21199
- if (_this5.cacheRtcStats.freezeCount !== void 0) {
21200
- rtc_stats.freeze_count = freezeCount - _this5.cacheRtcStats.freezeCount;
21201
- 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;
21202
21303
  }
21203
- _this5.cacheRtcStats.freezeCount = freezeCount;
21204
- _this5.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
21205
- _this5.cacheRtcStats.framesReceived = framesReceived;
21304
+ _this9.cacheRtcStats.freezeCount = freezeCount;
21305
+ _this9.cacheRtcStats.totalFreezesDuration = totalFreezesDuration;
21306
+ _this9.cacheRtcStats.framesReceived = framesReceived;
21206
21307
  rtc_stats.total_pauses_duration = totalPausesDuration;
21207
- rtc_stats.video_jb_delay = jitterBufferDelay / jitterBufferEmittedCount * 1e3;
21208
21308
  rtc_stats.video_jitter = jitter * 1e3;
21209
21309
  rtc_stats.video_nack_count = nackCount;
21210
- rtc_stats.video_packets_lost = packetsLost - (_this5.cacheRtcStats.videoPacketsLost || 0);
21211
- 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);
21212
21312
  rtc_stats.video_fraction_lost = rtc_stats.video_packets_lost / rtc_stats.video_packets_received;
21213
- _this5.cacheRtcStats.videoPacketsLost = packetsLost;
21214
- _this5.cacheRtcStats.videoPacketsReceived = packetsReceived;
21313
+ _this9.cacheRtcStats.videoPacketsLost = packetsLost;
21314
+ _this9.cacheRtcStats.videoPacketsReceived = packetsReceived;
21215
21315
  rtc_stats.video_pli_count = pliCount;
21216
21316
  rtc_stats.decoder_name = decoderImplementation;
21217
21317
  }
@@ -21235,13 +21335,12 @@ var __publicField = (obj, key, value) => {
21235
21335
  rtc_stats.audio_codec = mediaType;
21236
21336
  }
21237
21337
  }
21238
- rtc_stats.total_delay = rtc_stats.e2e_delay_ms + (rtc_stats.video_decoded_delay_ms || 0) + (rtc_stats.video_jb_delay || 0);
21239
21338
  });
21240
- Object.assign(_this5.log.playing, {
21339
+ Object.assign(_this9.log.playing, {
21241
21340
  video_download_size: rtc_stats.video_bytes_received,
21242
21341
  decode_fps: rtc_stats.video_decode_framerate,
21243
- sei_delay: rtc_stats.total_delay,
21244
- sei_network_delay: rtc_stats.e2e_delay_ms,
21342
+ // sei_delay: rtc_stats.total_delay,
21343
+ // sei_network_delay: rtc_stats.e2e_delay_ms,
21245
21344
  width: rtc_stats.video_frame_width,
21246
21345
  height: rtc_stats.video_frame_height,
21247
21346
  current_speed: (rtc_stats.audio_bytes_received + rtc_stats.video_bytes_received) / duration
@@ -21254,31 +21353,34 @@ var __publicField = (obj, key, value) => {
21254
21353
  };
21255
21354
  _proto2.reportPlaying = function reportPlaying(first) {
21256
21355
  try {
21257
- var _this7 = this;
21258
- if (_this7.commonParams.is_wasm) {
21259
- _this7.commonParams.fps = _this7.player.video.fps;
21260
- _this7.log.playing.render_fps = _this7.player.video.fps;
21261
- _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;
21262
21361
  }
21263
- _this7.log.playing.index++;
21264
- var lastPlayingTime = _this7.log.playing.timestamp;
21362
+ _this11.log.playing.index++;
21363
+ var lastPlayingTime = _this11.log.playing.timestamp;
21265
21364
  var stallTime;
21266
- if (_this7.inWaitingStart && _this7.inWaitingStart < getCurrentTime()) {
21267
- 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));
21268
21367
  }
21269
- _this7.getPlayerQuality();
21270
- _this7.getPlayerBuffer();
21271
- if (!_this7.options.downloadSpeedInterval) {
21272
- _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;
21273
21375
  }
21274
21376
  var now2 = getCurrentTime();
21275
21377
  var playedTime = now2 - lastPlayingTime;
21276
- var stall_time = (stallTime > 200 ? stallTime : 0) + _this7.log.playing.stall_time;
21277
- var stall_count = (stallTime > 200 ? 1 : 0) + _this7.log.playing.stall_count;
21278
- if (_this7.options.aggregationDowngradeStallTime) {
21279
- _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);
21280
21382
  }
21281
- Object.assign(_this7.log.playing, _objectSpread2({
21383
+ Object.assign(_this11.log.playing, _objectSpread2(_objectSpread2({
21282
21384
  timestamp: now2,
21283
21385
  // 60s内存在多次触发playing
21284
21386
  stop_time: now2,
@@ -21290,37 +21392,41 @@ var __publicField = (obj, key, value) => {
21290
21392
  stall_count,
21291
21393
  // playing前会有一次卡顿现处于waiting状态
21292
21394
  stall_time,
21293
- play_current_time: _this7.player.currentTime
21294
- }, _this7.videoSize));
21295
- 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) {
21296
21402
  var flvStats = {};
21297
- if (_this7.core) {
21298
- if (_this7.core.getStats) {
21299
- 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;
21300
21406
  Object.assign(flvStats, {
21301
21407
  bitrate,
21302
- avg_speed: avgSpeed,
21303
- rate: avgSpeed / bitrate
21408
+ avg_speed: _avgSpeed,
21409
+ rate: _avgSpeed / bitrate
21304
21410
  });
21305
21411
  }
21306
- if (_this7.core.getNetWorkInfo) {
21307
- var _this7$core$core;
21308
- var _ref3 = _this7.core.getNetWorkInfo() || {}, lostRate = _ref3.lostRate;
21309
- 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;
21310
21416
  Object.assign(flvStats, {
21311
21417
  lostRate,
21312
21418
  networkEvaluateInterval
21313
21419
  });
21314
21420
  }
21315
21421
  }
21316
- _this7.logmanager.push(Object.assign({}, _this7.log.playing, _objectSpread2(_objectSpread2({
21422
+ _this11.logmanager.push(Object.assign({}, _this11.log.playing, _objectSpread2(_objectSpread2({
21317
21423
  play_time: first ? 0 : playedTime
21318
21424
  }, stats), flvStats)), true);
21319
- _this7.log.playing.download_speed_array = [];
21320
- _this7.log.playing.stall_time = 0;
21321
- _this7.log.playing.stall_count = 0;
21322
- if (_this7.options.aggregationDowngradeStallTime) {
21323
- _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;
21324
21430
  }
21325
21431
  });
21326
21432
  } catch (e2) {
@@ -21329,64 +21435,71 @@ var __publicField = (obj, key, value) => {
21329
21435
  };
21330
21436
  _proto2.handlePlayerPlaying = function handlePlayerPlaying() {
21331
21437
  try {
21332
- var _this9 = this;
21333
- if (_this9.player && _this9.player.video.readyState < 3) {
21438
+ var _this13 = this;
21439
+ if (_this13.player && _this13.player.video.readyState < 3) {
21440
+ return Promise.resolve();
21441
+ }
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();
21334
21449
  return Promise.resolve();
21335
21450
  }
21336
- _this9.player.off("playing", _this9.handlePlayerPlaying);
21337
- _this9.player.off("timeupdate", _this9.handlePlayerPlaying);
21338
- if (_this9.core && _this9.core.getStats) {
21339
- var _ref5 = _this9.core.getStats() || {}, fps = _ref5.fps;
21340
- _this9.commonParams.fps = fps;
21451
+ if (_this13.core && _this13.core.getStats) {
21452
+ var _ref6 = _this13.core.getStats() || {}, fps = _ref6.fps;
21453
+ _this13.commonParams.fps = fps;
21341
21454
  }
21342
- return Promise.resolve(_this9.reportPlaying(true)).then(function() {
21343
- _this9.clearPlayingInterval();
21344
- var timer = _this9.options.playingInterval || _this9.log.playing.play_time;
21345
- _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() {
21346
21459
  try {
21347
- var _temp4 = function() {
21348
- if (Math.abs(Date.now() - _this9.log.playing.timestamp - timer) < 100 || Date.now() - _this9.log.playing.timestamp >= timer) {
21349
- var _temp5 = function() {
21350
- if (!_this9.player || !_this9.player.video) {
21351
- _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();
21352
21465
  } else {
21353
- var _temp6 = function() {
21354
- if (_this9.player.paused) {
21355
- _this9.handleVideopause();
21466
+ var _temp10 = function() {
21467
+ if (_this13.player.paused) {
21468
+ _this13.handleVideopause();
21356
21469
  } else {
21357
- return Promise.resolve(_this9.reportPlaying()).then(function() {
21470
+ return Promise.resolve(_this13.reportPlaying()).then(function() {
21358
21471
  });
21359
21472
  }
21360
21473
  }();
21361
- if (_temp6 && _temp6.then)
21362
- return _temp6.then(function() {
21474
+ if (_temp10 && _temp10.then)
21475
+ return _temp10.then(function() {
21363
21476
  });
21364
21477
  }
21365
21478
  }();
21366
- if (_temp5 && _temp5.then)
21367
- return _temp5.then(function() {
21479
+ if (_temp9 && _temp9.then)
21480
+ return _temp9.then(function() {
21368
21481
  });
21369
21482
  }
21370
21483
  }();
21371
- return Promise.resolve(_temp4 && _temp4.then ? _temp4.then(function() {
21484
+ return Promise.resolve(_temp8 && _temp8.then ? _temp8.then(function() {
21372
21485
  }) : void 0);
21373
21486
  } catch (e2) {
21374
21487
  return Promise.reject(e2);
21375
21488
  }
21376
21489
  }, 1e3);
21377
- _this9.clearStallTimer();
21378
- _this9.handleVideoplaying();
21379
- if (!_this9.started) {
21380
- _this9.reportStartPlay();
21490
+ _this13.clearStallTimer();
21491
+ _this13.handleVideoplaying();
21492
+ if (!_this13.started) {
21493
+ _this13.reportStartPlay();
21381
21494
  }
21382
- _this9.saveBuffered();
21495
+ _this13.saveBuffered();
21383
21496
  });
21384
21497
  } catch (e2) {
21385
21498
  return Promise.reject(e2);
21386
21499
  }
21387
21500
  };
21388
21501
  _proto2.handlePlayerReady = function handlePlayerReady() {
21389
- var _this10 = this;
21502
+ var _this14 = this;
21390
21503
  this.log.start_play.start_play_time = getCurrentTime();
21391
21504
  if (this.player.config.autoplay) {
21392
21505
  this.reportStartPlay();
@@ -21397,14 +21510,16 @@ var __publicField = (obj, key, value) => {
21397
21510
  this.clearPlayResultTimer();
21398
21511
  this.log.play_result.start = getCurrentTime();
21399
21512
  this.playResultTimer = setTimeout(function() {
21400
- if (_this10.log.play_result.timestamp >= _this10.log.play_result.start)
21513
+ if (_this14.log.play_result.timestamp >= _this14.log.play_result.start)
21401
21514
  return;
21402
- _this10.log.play_result.is_threshold = 1;
21403
- _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);
21404
21519
  }, this.log.play_result.threshold);
21405
21520
  };
21406
21521
  _proto2.handlePlayerWaiting = function handlePlayerWaiting() {
21407
- var _this11 = this;
21522
+ var _this15 = this;
21408
21523
  if (!!this.inWaitingStart || !this.log.first_frame.timestamp)
21409
21524
  return;
21410
21525
  this.log.stall.timestamp = this.inWaitingStart = this.log.stall.stall_start = getCurrentTime();
@@ -21416,11 +21531,13 @@ var __publicField = (obj, key, value) => {
21416
21531
  this.log.stall.play_current_time = this.player.currentTime;
21417
21532
  this.log.stall_start.buffered = this.getBuffered();
21418
21533
  this.log.stall.buffered = this.log.stall_start.buffered;
21419
- 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;
21420
21537
  Object.assign(this.log.stall_start, this.videoSize);
21421
21538
  this.clearStallTimer();
21422
21539
  this.stallStartTimer = setTimeout(function() {
21423
- _this11.logmanager.push(_this11.log.stall_start, true);
21540
+ _this15.logmanager.push(_this15.log.stall_start, true);
21424
21541
  }, 205);
21425
21542
  };
21426
21543
  _proto2.handleVideoseeking = function handleVideoseeking() {
@@ -21491,37 +21608,36 @@ var __publicField = (obj, key, value) => {
21491
21608
  _proto2.handleVideoended = function handleVideoended() {
21492
21609
  this.clearPlayingInterval();
21493
21610
  this.clearStallTimer();
21494
- Object.assign(this.log.playing, _objectSpread2({
21495
- timestamp: getCurrentTime(),
21611
+ Object.assign(this.log.playing, {
21496
21612
  is_last: 1
21497
- }, this.videoSize));
21498
- this.logmanager.push(this.log.playing);
21613
+ });
21614
+ this.reportPlaying();
21499
21615
  };
21500
21616
  _proto2.handleVideoerror = function handleVideoerror() {
21501
- var _this12 = this;
21617
+ var _this16 = this;
21502
21618
  this.errorNumber = 1;
21503
21619
  var error2 = this.player.video.error;
21504
21620
  var firstframeFailed = function firstframeFailed2() {
21505
- 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) {
21506
21622
  if (error2) {
21507
- _this12.log.first_frame_failed.code = error2.code;
21508
- _this12.log.first_frame_failed.msg = video_error[error2.code];
21509
- if (_this12.log.first_frame_failed.timestamp !== void 0) {
21510
- _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();
21511
21627
  }
21512
- _this12.logmanager.push(_this12.log.first_frame_failed, true);
21513
- if (!_this12.log.play_result.is_threshold) {
21514
- _this12.log.play_result.reason = video_error[error2.code] || "first frame failed";
21515
- _this12.log.play_result.code = error2.code;
21516
- _this12.clearPlayResultTimer();
21517
- _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);
21518
21634
  }
21519
21635
  }
21520
21636
  }
21521
- if (_this12.options.error_report_stop) {
21522
- _this12.handleUserLeave();
21637
+ if (_this16.options.error_report_stop) {
21638
+ _this16.handleUserLeave();
21523
21639
  } else {
21524
- _this12.updatePlayStopParams();
21640
+ _this16.updatePlayStopParams();
21525
21641
  }
21526
21642
  };
21527
21643
  Object.assign(this.log.play_error, _objectSpread2(_objectSpread2({
@@ -21542,7 +21658,7 @@ var __publicField = (obj, key, value) => {
21542
21658
  this.player.once("timeupdate", this.handlePlayerPlaying);
21543
21659
  };
21544
21660
  _proto2.destroyFunc = function destroyFunc(no_report_stop) {
21545
- var _this13 = this;
21661
+ var _this17 = this;
21546
21662
  if (this.destroyed) {
21547
21663
  return;
21548
21664
  }
@@ -21556,7 +21672,7 @@ var __publicField = (obj, key, value) => {
21556
21672
  window.removeEventListener("pagehide", this.handleUserLeave);
21557
21673
  }
21558
21674
  videoEvts.forEach(function(name) {
21559
- _this13.removeVideoEvt(name, _this13["handleVideo" + name + "Evt"]);
21675
+ _this17.removeVideoEvt(name, _this17["handleVideo" + name + "Evt"]);
21560
21676
  });
21561
21677
  if (this.player) {
21562
21678
  if (this.player._start) {
@@ -21580,26 +21696,26 @@ var __publicField = (obj, key, value) => {
21580
21696
  this.player.off("bufferappend", this.handleBufferAppend);
21581
21697
  this.player.off("core_event", this.handleCoreEvent);
21582
21698
  this.player.off("degrade", this.handleDegrade);
21583
- this._player = null;
21584
21699
  }
21585
21700
  this.clearPlayingInterval();
21586
21701
  this.clearStallTimer();
21587
21702
  this.clearPlayResultTimer();
21588
21703
  clearTimeout(this.collectDownloadSpeedTimer);
21704
+ this._player = null;
21589
21705
  };
21590
21706
  _proto2.handleUserLeave = function handleUserLeave() {
21591
21707
  try {
21592
- var _this15 = this;
21593
- if (_this15.destroyed || !_this15.started) {
21708
+ var _this19 = this;
21709
+ if (_this19.destroyed || !_this19.started) {
21594
21710
  return Promise.resolve();
21595
21711
  }
21596
- _this15.destroyed = true;
21597
- return Promise.resolve(_this15.updatePlayStopParams()).then(function() {
21598
- _this15.reportPlayStop();
21599
- _this15.clearPlayingInterval();
21600
- _this15.clearStallTimer();
21601
- clearTimeout(_this15.collectDownloadSpeedTimer);
21602
- _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();
21603
21719
  });
21604
21720
  } catch (e2) {
21605
21721
  return Promise.reject(e2);
@@ -21630,94 +21746,94 @@ var __publicField = (obj, key, value) => {
21630
21746
  this.log.play_stop.play_current_time = this.player.currentTime || this.log.playing.play_current_time;
21631
21747
  this.saveBuffered();
21632
21748
  }
21633
- this.logmanager.push(this.log.play_stop, true);
21749
+ this.logmanager.push(this.log.play_stop);
21634
21750
  };
21635
21751
  _proto2.reportFirstframe = function reportFirstframe() {
21636
21752
  if (this.firstFrameViewed) {
21637
21753
  return;
21638
21754
  }
21639
21755
  if (this.core && this.core.getStats) {
21640
- var _ref6 = this.core.getStats() || {}, fps = _ref6.fps;
21756
+ var _ref7 = this.core.getStats() || {}, fps = _ref7.fps;
21641
21757
  this.commonParams.fps = fps;
21642
21758
  }
21759
+ var transferCost = this.getTransferCost(true);
21643
21760
  this.firstFrameViewed = true;
21644
21761
  var currentTime = getCurrentTime();
21645
- Object.assign(this.log.first_frame, _objectSpread2({
21762
+ Object.assign(this.log.first_frame, _objectSpread2(_objectSpread2({
21646
21763
  first_frame_view: currentTime - this.log.start_play.start_play_time || currentTime,
21647
21764
  timestamp: currentTime
21648
- }, this.videoSize));
21765
+ }, transferCost), this.videoSize));
21649
21766
  if (this.log.first_frame.ttfb_end) {
21650
21767
  this.log.first_frame.ttdb = currentTime - this.log.first_frame.ttfb_end;
21651
21768
  }
21652
- this.logmanager.push(this.log.first_frame, true);
21769
+ this.logmanager.push(this.log.first_frame);
21653
21770
  this.clearPlayResultTimer();
21654
21771
  this.log.play_result.result = 1;
21655
- this.logmanager.push(this.log.play_result, true);
21772
+ this.logmanager.push(this.log.play_result);
21656
21773
  this.log.play_stop.is_stream_received = 1;
21657
21774
  };
21658
21775
  _proto2.updatePlayStopParams = function updatePlayStopParams() {
21659
21776
  try {
21660
- var _this17$core;
21661
- var _temp9 = function _temp92() {
21777
+ var _this21$core;
21778
+ var _temp13 = function _temp132() {
21662
21779
  Object.assign(play_stop, _objectSpread2({
21663
21780
  timestamp: endTime,
21664
21781
  stop_time: endTime,
21665
- duration: _this17.playedTime / 1e3,
21666
- play_time: _this17.playedTime / 1e3
21667
- }, _this17.videoSize));
21668
- if (_this17.errorNumber === 0) {
21669
- 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;
21670
21787
  }
21671
21788
  };
21672
- var _this17 = this;
21673
- var timing = getResourceTiming(_this17._url);
21789
+ var _this21 = this;
21790
+ var timing = getResourceTiming(_this21._url);
21674
21791
  var endTime = getCurrentTime();
21675
- _this17.playedTime = endTime - _this17.log.start_play.start_play_time;
21676
- 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;
21677
21794
  Object.assign(play_stop, _objectSpread2({}, play_stop.stall_count === 0 && {
21678
21795
  stall_time: 0
21679
21796
  }));
21680
- if (_this17.inWaitingStart && endTime - _this17.inWaitingStart > 200) {
21681
- play_stop.stall_time += endTime - _this17.inWaitingStart;
21797
+ if (_this21.inWaitingStart && endTime - _this21.inWaitingStart > 200) {
21798
+ play_stop.stall_time += endTime - _this21.inWaitingStart;
21682
21799
  }
21683
- _this17.inWaitingStart = 0;
21800
+ _this21.inWaitingStart = 0;
21684
21801
  Object.assign(play_stop, _objectSpread2({
21685
- stall_time_per_100sec: play_stop.stall_time / _this17.playedTime * 100,
21802
+ stall_time_per_100sec: play_stop.stall_time / _this21.playedTime * 100,
21686
21803
  // 计算百秒卡顿时长
21687
- 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
21688
21805
  }, timing));
21689
- if (_this17.log.play_stop.stall_count_per_100sec === 0) {
21690
- _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;
21691
21808
  }
21692
- 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) {
21693
21810
  return Promise.resolve();
21694
21811
  }
21695
- if (_this17.log.playing.index) {
21696
- Object.assign(_this17.log.playing, _objectSpread2({
21697
- timestamp: getCurrentTime(),
21812
+ if (_this21.log.playing.index) {
21813
+ Object.assign(_this21.log.playing, {
21698
21814
  is_last: 1
21699
- }, _this17.videoSize));
21700
- _this17.logmanager.push(_this17.log.playing, true);
21815
+ });
21816
+ _this21.reportPlaying();
21701
21817
  } else {
21702
- _this17.log.play_stop.error_code = _this17.log.play_error.code;
21703
- _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;
21704
21820
  }
21705
21821
  endTime = getCurrentTime();
21706
- if ((_this17$core = _this17.core) === null || _this17$core === void 0 ? void 0 : _this17$core.getStats) {
21707
- var _ref7 = _this17.core.getStats() || {}, totalReceivedByte = _ref7.totalReceivedByte, totalReceivedCost = _ref7.totalReceivedCost;
21708
- 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, {
21709
21825
  totalReceivedByte,
21710
21826
  totalReceivedCost,
21711
21827
  totalAverageSpeed: totalReceivedByte * 8 / (totalReceivedCost / 1e3)
21712
21828
  // bps
21713
21829
  });
21714
21830
  }
21715
- var _temp10 = function() {
21716
- var _this17$core2;
21717
- if ((_this17$core2 = _this17.core) === null || _this17$core2 === void 0 ? void 0 : _this17$core2.getStatsSnapshoot) {
21718
- return Promise.resolve(_this17.core.getStatsSnapshoot()).then(function(_ref8) {
21719
- var video = _ref8.video;
21720
- 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;
21721
21837
  Object.assign(play_stop, {
21722
21838
  packetsLost,
21723
21839
  packetsReceived,
@@ -21726,7 +21842,7 @@ var __publicField = (obj, key, value) => {
21726
21842
  });
21727
21843
  }
21728
21844
  }();
21729
- return Promise.resolve(_temp10 && _temp10.then ? _temp10.then(_temp9) : _temp9(_temp10));
21845
+ return Promise.resolve(_temp14 && _temp14.then ? _temp14.then(_temp13) : _temp13(_temp14));
21730
21846
  } catch (e2) {
21731
21847
  return Promise.reject(e2);
21732
21848
  }
@@ -22523,8 +22639,6 @@ var __publicField = (obj, key, value) => {
22523
22639
  class Logger extends Plugin {
22524
22640
  constructor() {
22525
22641
  super(...arguments);
22526
- __publicField(this, "_userId");
22527
- __publicField(this, "_deviceId");
22528
22642
  __publicField(this, "_liveLogger");
22529
22643
  }
22530
22644
  static get pluginName() {
@@ -22580,8 +22694,8 @@ var __publicField = (obj, key, value) => {
22580
22694
  });
22581
22695
  q.start();
22582
22696
  q.config({
22583
- user_unique_id: this._userId,
22584
- device_id: this._deviceId
22697
+ user_unique_id: this.config.userId,
22698
+ device_id: this.config.deviceId
22585
22699
  });
22586
22700
  }
22587
22701
  _start() {
@@ -22592,11 +22706,11 @@ var __publicField = (obj, key, value) => {
22592
22706
  aid: this.config.appId || 654925,
22593
22707
  project_key: this.config.appId,
22594
22708
  app_name: this.config.appName || this.config.appId,
22595
- user_id: this._userId,
22596
- device_id: this._deviceId,
22709
+ user_id: this.config.userId,
22710
+ device_id: this.config.deviceId,
22597
22711
  error_report_stop: true,
22598
22712
  ext: {
22599
- veplayer_version: "2.7.1-rc.0",
22713
+ veplayer_version: "2.7.1-rc.1",
22600
22714
  flv_version: "3.0.21-rc.21",
22601
22715
  hls_version: "3.0.21-rc.21",
22602
22716
  rts_version: "0.2.1-alpha.14"