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

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