@byteplus/veplayer-plugin 2.10.1 → 2.10.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.
@@ -1764,6 +1764,7 @@ var PAUSE$1 = "pause";
1764
1764
  var ERROR$1 = "error";
1765
1765
  var TIME_UPDATE$1 = "timeupdate";
1766
1766
  var WAITING = "waiting";
1767
+ var CANPLAY = "canplay";
1767
1768
  var LOADED_DATA$1 = "loadeddata";
1768
1769
  var LOAD_START = "loadstart";
1769
1770
  var DESTROY = "destroy";
@@ -2245,6 +2246,37 @@ function listener$1(element, selector, type, callback) {
2245
2246
  }
2246
2247
  var delegate_1 = delegate;
2247
2248
  var _delegate$1 = /* @__PURE__ */ getDefaultExportFromCjs$3(delegate_1);
2249
+ var STATE_CLASS$1 = {
2250
+ DEFAULT: "xgplayer",
2251
+ DEFAULT_SKIN: "xgplayer-skin-default",
2252
+ ENTER: "xgplayer-is-enter",
2253
+ PAUSED: "xgplayer-pause",
2254
+ PLAYING: "xgplayer-playing",
2255
+ ENDED: "xgplayer-ended",
2256
+ CANPLAY: "xgplayer-canplay",
2257
+ LOADING: "xgplayer-isloading",
2258
+ ERROR: "xgplayer-is-error",
2259
+ REPLAY: "xgplayer-replay",
2260
+ NO_START: "xgplayer-nostart",
2261
+ ACTIVE: "xgplayer-active",
2262
+ INACTIVE: "xgplayer-inactive",
2263
+ FULLSCREEN: "xgplayer-is-fullscreen",
2264
+ CSS_FULLSCREEN: "xgplayer-is-cssfullscreen",
2265
+ ROTATE_FULLSCREEN: "xgplayer-rotate-fullscreen",
2266
+ PARENT_ROTATE_FULLSCREEN: "xgplayer-rotate-parent",
2267
+ PARENT_FULLSCREEN: "xgplayer-fullscreen-parent",
2268
+ INNER_FULLSCREEN: "xgplayer-fullscreen-inner",
2269
+ NO_CONTROLS: "no-controls",
2270
+ FLEX_CONTROLS: "flex-controls",
2271
+ CONTROLS_FOLLOW: "controls-follow",
2272
+ CONTROLS_AUTOHIDE: "controls-autohide",
2273
+ TOP_BAR_AUTOHIDE: "top-bar-autohide",
2274
+ NOT_ALLOW_AUTOPLAY: "not-allow-autoplay",
2275
+ SEEKING: "seeking",
2276
+ PC: "xgplayer-pc",
2277
+ MOBILE: "xgplayer-mobile",
2278
+ MINI: "xgplayer-mini"
2279
+ };
2248
2280
  function ownKeys$f(object, enumerableOnly) {
2249
2281
  var keys9 = Object.keys(object);
2250
2282
  if (Object.getOwnPropertySymbols) {
@@ -32651,7 +32683,7 @@ function diffRecvVideoStats(oldStats, newStats) {
32651
32683
  width: newStats.width || 0,
32652
32684
  height: newStats.height || 0,
32653
32685
  estimatedPlayoutTimestamp: newStats.estimatedPlayoutTimestamp,
32654
- videoLossRate: +(packetsLostDiff / (diffNumber(oldStats, newStats, "packetsReceived") + packetsLostDiff)),
32686
+ videoLossRate: +(packetsLostDiff / (diffNumber(oldStats, newStats, "packetsReceived") + packetsLostDiff)).toFixed(2),
32655
32687
  receivedKBitrate: +(diffNumber(oldStats, newStats, "bytesReceived") * 8 / statsInterval).toFixed(2),
32656
32688
  decoderOutputFrameRate: Math.round(diffNumber(oldStats, newStats, "framesDecoded") * 1e3 / statsInterval),
32657
32689
  receivedFrameRate: Math.round(diffNumber(oldStats, newStats, "framesReceived") * 1e3 / statsInterval),
@@ -32833,13 +32865,22 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
32833
32865
  }
32834
32866
  };
32835
32867
  this._handlePlaying = function() {
32868
+ if (!_this._state[RTC_FIRST_FRAME_STATE.PEER_CONNECTED]) {
32869
+ return;
32870
+ }
32836
32871
  _this.changeFirstFrameState(RTC_FIRST_FRAME_STATE.VIDEO_PLAYING);
32837
32872
  _this.reset();
32838
32873
  };
32839
32874
  this._handleCanplay = function() {
32875
+ if (!_this._state[RTC_FIRST_FRAME_STATE.PEER_CONNECTED]) {
32876
+ return;
32877
+ }
32840
32878
  _this.changeFirstFrameState(RTC_FIRST_FRAME_STATE.VIDEO_CANPLAY);
32841
32879
  };
32842
32880
  this._handleLoadeddata = function() {
32881
+ if (!_this._state[RTC_FIRST_FRAME_STATE.PEER_CONNECTED]) {
32882
+ return;
32883
+ }
32843
32884
  _this.changeFirstFrameState(RTC_FIRST_FRAME_STATE.VIDEO_LOADEDDATA);
32844
32885
  };
32845
32886
  this._handleError = function() {
@@ -32906,6 +32947,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
32906
32947
  var hasFrameDecoded = false;
32907
32948
  this._cancelWatchForFirstVideoFrameRecv();
32908
32949
  this._firstVideoFrameInterval = window.setInterval(/* @__PURE__ */ _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee() {
32950
+ var _inboundRtpStats, _inboundRtpStats2, _inboundRtpStats3;
32909
32951
  var receiver, reports, inboundRtpStats;
32910
32952
  return _regeneratorRuntime$a().wrap(function _callee$(_context) {
32911
32953
  while (1)
@@ -32921,15 +32963,15 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
32921
32963
  inboundRtpStats = report;
32922
32964
  }
32923
32965
  });
32924
- if (!hasPacketsReceived && inboundRtpStats.packetsReceived > 0) {
32966
+ if (!hasPacketsReceived && (_inboundRtpStats = inboundRtpStats) !== null && _inboundRtpStats !== void 0 && _inboundRtpStats.packetsReceived && inboundRtpStats.packetsReceived > 0) {
32925
32967
  hasPacketsReceived = true;
32926
32968
  _this4.changeFirstFrameState(RTC_FIRST_FRAME_STATE.FIRST_PACKET_RECV);
32927
32969
  }
32928
- if (!hasFrameReceived && inboundRtpStats.framesReceived > 0) {
32970
+ if (!hasFrameReceived && (_inboundRtpStats2 = inboundRtpStats) !== null && _inboundRtpStats2 !== void 0 && _inboundRtpStats2.framesReceived && inboundRtpStats.framesReceived > 0) {
32929
32971
  hasFrameReceived = true;
32930
32972
  _this4.changeFirstFrameState(RTC_FIRST_FRAME_STATE.FIRST_FRAME_RECV);
32931
32973
  }
32932
- if (!hasFrameDecoded && inboundRtpStats.framesDecoded > 0) {
32974
+ if (!hasFrameDecoded && (_inboundRtpStats3 = inboundRtpStats) !== null && _inboundRtpStats3 !== void 0 && _inboundRtpStats3.framesDecoded && inboundRtpStats.framesDecoded > 0) {
32933
32975
  hasFrameDecoded = true;
32934
32976
  _this4.changeFirstFrameState(RTC_FIRST_FRAME_STATE.FIRST_FRAME_DECODED);
32935
32977
  _this4._cancelWatchForFirstVideoFrameRecv();
@@ -32949,103 +32991,84 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
32949
32991
  this._firstVideoFrameInterval = null;
32950
32992
  }
32951
32993
  }
32952
- }, {
32953
- key: "_getTransportInfo",
32954
- value: function() {
32955
- var _getTransportInfo2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee2() {
32956
- var _this$_videoTransceiv, _this$_videoTransceiv2;
32957
- var reports, candidatePairStats, localCandidateStats, remoteCandidateStats;
32958
- return _regeneratorRuntime$a().wrap(function _callee2$(_context2) {
32959
- while (1)
32960
- switch (_context2.prev = _context2.next) {
32961
- case 0:
32962
- _context2.next = 2;
32963
- return (_this$_videoTransceiv = this._videoTransceiver) === null || _this$_videoTransceiv === void 0 ? void 0 : (_this$_videoTransceiv2 = _this$_videoTransceiv.receiver) === null || _this$_videoTransceiv2 === void 0 ? void 0 : _this$_videoTransceiv2.getStats();
32964
- case 2:
32965
- reports = _context2.sent;
32966
- reports === null || reports === void 0 ? void 0 : reports.forEach(function(report) {
32967
- if (report.type === "candidate-pair") {
32968
- candidatePairStats = report;
32969
- localCandidateStats = reports.get(report.localCandidateId);
32970
- remoteCandidateStats = reports.get(report.remoteCandidateId);
32971
- }
32972
- });
32973
- if (remoteCandidateStats) {
32974
- this._extraInfo.remote_ip = remoteCandidateStats.ip || remoteCandidateStats.address;
32975
- this._extraInfo.remote_port = remoteCandidateStats.port;
32976
- this._extraInfo.remote_candidate_type = remoteCandidateStats.candidateType;
32977
- this._extraInfo.protocol = remoteCandidateStats.protocol;
32978
- }
32979
- if (localCandidateStats) {
32980
- this._extraInfo.local_ip = localCandidateStats.ip || localCandidateStats.address;
32981
- this._extraInfo.local_port = localCandidateStats.port;
32982
- this._extraInfo.local_candidate_type = localCandidateStats.candidateType;
32983
- }
32984
- if (candidatePairStats) {
32985
- this._extraInfo.rtt = candidatePairStats.currentRoundTripTime;
32986
- this._extraInfo.stun_requests_sent = candidatePairStats.requestsSent;
32987
- this._extraInfo.stun_requests_received = candidatePairStats.requestsReceived;
32988
- this._extraInfo.stun_responses_sent = candidatePairStats.responsesSent;
32989
- this._extraInfo.stun_responses_received = candidatePairStats.responsesReceived;
32990
- }
32991
- case 7:
32992
- case "end":
32993
- return _context2.stop();
32994
- }
32995
- }, _callee2, this);
32996
- }));
32997
- function _getTransportInfo() {
32998
- return _getTransportInfo2.apply(this, arguments);
32999
- }
33000
- return _getTransportInfo;
33001
- }()
33002
32994
  }, {
33003
32995
  key: "reset",
33004
- value: function() {
33005
- var _reset = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee3() {
33006
- var _this$_video, _this$_video2, _this$_video3, _this$_video4, _this$_pc3, _this$_pc4;
33007
- return _regeneratorRuntime$a().wrap(function _callee3$(_context3) {
33008
- while (1)
33009
- switch (_context3.prev = _context3.next) {
33010
- case 0:
33011
- if (!(Object.keys(this._state).length > 0)) {
33012
- _context3.next = 4;
33013
- break;
33014
- }
33015
- _context3.next = 3;
33016
- return this._getTransportInfo();
33017
- case 3:
33018
- this._emitFirstFrameState(this._state, this._extraInfo);
33019
- case 4:
33020
- this._preState = null;
33021
- this._extraInfo = {
33022
- is_preload: false
33023
- };
33024
- this._state = {};
33025
- (_this$_video = this._video) === null || _this$_video === void 0 ? void 0 : _this$_video.removeEventListener("playing", this._handlePlaying);
33026
- (_this$_video2 = this._video) === null || _this$_video2 === void 0 ? void 0 : _this$_video2.removeEventListener("canplay", this._handleCanplay);
33027
- (_this$_video3 = this._video) === null || _this$_video3 === void 0 ? void 0 : _this$_video3.removeEventListener("loadeddata", this._handleLoadeddata);
33028
- (_this$_video4 = this._video) === null || _this$_video4 === void 0 ? void 0 : _this$_video4.removeEventListener("error", this._handleError);
33029
- (_this$_pc3 = this._pc) === null || _this$_pc3 === void 0 ? void 0 : _this$_pc3.removeEventListener("connectionstatechange", this._handleConnectionStateChange);
33030
- (_this$_pc4 = this._pc) === null || _this$_pc4 === void 0 ? void 0 : _this$_pc4.removeEventListener("iceconnectionstatechange", this._handleICEConnectionStateChange);
33031
- this._cancelWatchForFirstVideoFrameRecv();
33032
- this._pc = null;
33033
- this._video = null;
33034
- this._videoTransceiver = null;
33035
- case 17:
33036
- case "end":
33037
- return _context3.stop();
33038
- }
33039
- }, _callee3, this);
33040
- }));
33041
- function reset() {
33042
- return _reset.apply(this, arguments);
33043
- }
33044
- return reset;
33045
- }()
32996
+ value: function reset() {
32997
+ var _this5 = this, _this$_video, _this$_video2, _this$_video3, _this$_video4, _this$_pc3, _this$_pc4;
32998
+ if (Object.keys(this._state).length > 0) {
32999
+ var state = _objectSpread2$b({}, this._state);
33000
+ var extraInfo = _objectSpread2$b({}, this._extraInfo);
33001
+ getTransportInfo(this._videoTransceiver, extraInfo).then(function() {
33002
+ _this5._emitFirstFrameState(state, extraInfo);
33003
+ });
33004
+ }
33005
+ this._preState = null;
33006
+ this._extraInfo = {
33007
+ is_preload: false
33008
+ };
33009
+ this._state = {};
33010
+ (_this$_video = this._video) === null || _this$_video === void 0 ? void 0 : _this$_video.removeEventListener("playing", this._handlePlaying);
33011
+ (_this$_video2 = this._video) === null || _this$_video2 === void 0 ? void 0 : _this$_video2.removeEventListener("canplay", this._handleCanplay);
33012
+ (_this$_video3 = this._video) === null || _this$_video3 === void 0 ? void 0 : _this$_video3.removeEventListener("loadeddata", this._handleLoadeddata);
33013
+ (_this$_video4 = this._video) === null || _this$_video4 === void 0 ? void 0 : _this$_video4.removeEventListener("error", this._handleError);
33014
+ (_this$_pc3 = this._pc) === null || _this$_pc3 === void 0 ? void 0 : _this$_pc3.removeEventListener("connectionstatechange", this._handleConnectionStateChange);
33015
+ (_this$_pc4 = this._pc) === null || _this$_pc4 === void 0 ? void 0 : _this$_pc4.removeEventListener("iceconnectionstatechange", this._handleICEConnectionStateChange);
33016
+ this._cancelWatchForFirstVideoFrameRecv();
33017
+ this._pc = null;
33018
+ this._video = null;
33019
+ this._videoTransceiver = null;
33020
+ }
33046
33021
  }]);
33047
33022
  return FirstFrameObserver2;
33048
33023
  }();
33024
+ var getTransportInfo = /* @__PURE__ */ function() {
33025
+ var _ref42 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee2(videoTransceiver, extraInfo) {
33026
+ var _videoTransceiver$rec;
33027
+ var reports, candidatePairStats, localCandidateStats, remoteCandidateStats;
33028
+ return _regeneratorRuntime$a().wrap(function _callee2$(_context2) {
33029
+ while (1)
33030
+ switch (_context2.prev = _context2.next) {
33031
+ case 0:
33032
+ _context2.next = 2;
33033
+ return videoTransceiver === null || videoTransceiver === void 0 ? void 0 : (_videoTransceiver$rec = videoTransceiver.receiver) === null || _videoTransceiver$rec === void 0 ? void 0 : _videoTransceiver$rec.getStats().catch(function() {
33034
+ });
33035
+ case 2:
33036
+ reports = _context2.sent;
33037
+ reports === null || reports === void 0 ? void 0 : reports.forEach(function(report) {
33038
+ if (report.type === "candidate-pair") {
33039
+ candidatePairStats = report;
33040
+ localCandidateStats = reports.get(report.localCandidateId);
33041
+ remoteCandidateStats = reports.get(report.remoteCandidateId);
33042
+ }
33043
+ });
33044
+ if (remoteCandidateStats) {
33045
+ extraInfo.remote_ip = remoteCandidateStats.ip || remoteCandidateStats.address;
33046
+ extraInfo.remote_port = remoteCandidateStats.port;
33047
+ extraInfo.remote_candidate_type = remoteCandidateStats.candidateType;
33048
+ extraInfo.protocol = remoteCandidateStats.protocol;
33049
+ }
33050
+ if (localCandidateStats) {
33051
+ extraInfo.local_ip = localCandidateStats.ip || localCandidateStats.address;
33052
+ extraInfo.local_port = localCandidateStats.port;
33053
+ extraInfo.local_candidate_type = localCandidateStats.candidateType;
33054
+ }
33055
+ if (candidatePairStats) {
33056
+ extraInfo.rtt = candidatePairStats.currentRoundTripTime;
33057
+ extraInfo.stun_requests_sent = candidatePairStats.requestsSent;
33058
+ extraInfo.stun_requests_received = candidatePairStats.requestsReceived;
33059
+ extraInfo.stun_responses_sent = candidatePairStats.responsesSent;
33060
+ extraInfo.stun_responses_received = candidatePairStats.responsesReceived;
33061
+ }
33062
+ case 7:
33063
+ case "end":
33064
+ return _context2.stop();
33065
+ }
33066
+ }, _callee2);
33067
+ }));
33068
+ return function getTransportInfo2(_x, _x2) {
33069
+ return _ref42.apply(this, arguments);
33070
+ };
33071
+ }();
33049
33072
  function changeNumberInRange(source, min2, max2, delta) {
33050
33073
  var target = source + delta;
33051
33074
  if (target > max2) {
@@ -33109,6 +33132,58 @@ function isHeyTapBrowser() {
33109
33132
  function isVivoBrowser() {
33110
33133
  return /(VivoBrowser)/i.test(navigator.userAgent);
33111
33134
  }
33135
+ var VideoFrameRecvCallback = /* @__PURE__ */ function() {
33136
+ function VideoFrameRecvCallback2() {
33137
+ var _this = this;
33138
+ _classCallCheck$k(this, VideoFrameRecvCallback2);
33139
+ this._onVideoRefresh = function(_, data2) {
33140
+ var _this$_domElement;
33141
+ _this._recentVideoInfo = data2;
33142
+ _this._requestVideoFrameCallbackTimer = (_this$_domElement = _this._domElement) === null || _this$_domElement === void 0 ? void 0 : _this$_domElement.requestVideoFrameCallback(_this._onVideoRefresh);
33143
+ };
33144
+ }
33145
+ _createClass$k(VideoFrameRecvCallback2, [{
33146
+ key: "start",
33147
+ value: function start(domElement) {
33148
+ var _this2 = this;
33149
+ this._domElement = domElement;
33150
+ if (typeof HTMLVideoElement.prototype.requestVideoFrameCallback === "function") {
33151
+ if (domElement) {
33152
+ this._requestVideoFrameCallbackTimer = domElement.requestVideoFrameCallback(this._onVideoRefresh.bind(this));
33153
+ this._removeHandler = function() {
33154
+ _this2._requestVideoFrameCallbackTimer && (domElement === null || domElement === void 0 ? void 0 : domElement.cancelVideoFrameCallback(_this2._requestVideoFrameCallbackTimer));
33155
+ };
33156
+ }
33157
+ }
33158
+ }
33159
+ }, {
33160
+ key: "stop",
33161
+ value: function stop() {
33162
+ var _this$_removeHandler;
33163
+ delete this._recentVideoInfo;
33164
+ delete this._domElement;
33165
+ (_this$_removeHandler = this._removeHandler) === null || _this$_removeHandler === void 0 ? void 0 : _this$_removeHandler.call(this);
33166
+ delete this._removeHandler;
33167
+ }
33168
+ }, {
33169
+ key: "getRecentRenderInfo4Report",
33170
+ value: function getRecentRenderInfo4Report() {
33171
+ var _this3 = this;
33172
+ var obj = {};
33173
+ if (this._recentVideoInfo) {
33174
+ Object.keys(this._recentVideoInfo).forEach(function(k2) {
33175
+ var _this3$_recentVideoIn;
33176
+ var key2 = k2.replace(/[a-z]{1}[A-Z]{1}/g, function(e4) {
33177
+ return "".concat(e4[0], "_").concat(e4[1].toLowerCase());
33178
+ });
33179
+ obj["video_".concat(key2)] = (_this3$_recentVideoIn = _this3._recentVideoInfo) === null || _this3$_recentVideoIn === void 0 ? void 0 : _this3$_recentVideoIn[k2];
33180
+ });
33181
+ }
33182
+ return obj;
33183
+ }
33184
+ }]);
33185
+ return VideoFrameRecvCallback2;
33186
+ }();
33112
33187
  var logger$b = new Logger$a("rts");
33113
33188
  var Rts = /* @__PURE__ */ function(_EventEmitter) {
33114
33189
  _inherits$f(Rts2, _EventEmitter);
@@ -33472,7 +33547,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33472
33547
  }, {
33473
33548
  key: "load",
33474
33549
  value: function() {
33475
- var _load = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee6(url2) {
33550
+ var _load = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee6(url2, failureReason) {
33476
33551
  var _this2 = this;
33477
33552
  var lastPc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
33478
33553
  return _regeneratorRuntime$a().wrap(function _callee6$(_context6) {
@@ -33480,7 +33555,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33480
33555
  switch (_context6.prev = _context6.next) {
33481
33556
  case 0:
33482
33557
  logger$b.log("load()", 'invoked, url: "'.concat(url2, '"'));
33483
- this._disconnect();
33558
+ this._disconnect(failureReason || "invoke load");
33484
33559
  this._url = url2;
33485
33560
  lastPc = this._pc;
33486
33561
  if (!this._opts.hackCreateOfferIssue) {
@@ -33493,7 +33568,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33493
33568
  _context6.prev = 7;
33494
33569
  this._firstFrameObserver.start();
33495
33570
  if (!this._preloadPromise) {
33496
- _context6.next = 39;
33571
+ _context6.next = 38;
33497
33572
  break;
33498
33573
  }
33499
33574
  logger$b.log("load()", "in preload process...");
@@ -33527,51 +33602,50 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33527
33602
  this.initVideoEncodedTransform();
33528
33603
  this.initAudioEncodedTransform();
33529
33604
  }
33530
- _context6.next = 37;
33605
+ _context6.next = 36;
33531
33606
  break;
33532
33607
  case 31:
33533
33608
  _context6.prev = 31;
33534
33609
  _context6.t0 = _context6["catch"](11);
33535
33610
  logger$b.warn("load()", "preload failed, ".concat(_context6.t0.message || _context6.t0.toString()));
33536
- this._firstFrameObserver.setFailureReason(_context6.t0.message || _context6.t0.toString());
33537
- this.load(url2);
33611
+ this.load(url2, _context6.t0.message || _context6.t0.toString());
33538
33612
  return _context6.abrupt("return");
33539
- case 37:
33540
- _context6.next = 45;
33613
+ case 36:
33614
+ _context6.next = 44;
33541
33615
  break;
33542
- case 39:
33616
+ case 38:
33543
33617
  encodedTransformSupported = isLegacyEncodedTransformSupported();
33544
33618
  logger$b.log("load()", "isLegacyEncodedTransformSupported: ".concat(encodedTransformSupported));
33545
33619
  this._pc = new RTCPeerConnection({
33546
33620
  encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
33547
33621
  });
33548
- _context6.next = 44;
33622
+ _context6.next = 43;
33549
33623
  return this._getAnswerSdp(this._pc);
33550
- case 44:
33624
+ case 43:
33551
33625
  answerSdp = _context6.sent;
33552
- case 45:
33626
+ case 44:
33553
33627
  this._bindRTCEvents(this._pc);
33554
- _context6.next = 48;
33628
+ _context6.next = 47;
33555
33629
  return this._handleAnswerSdp(this._pc, answerSdp);
33556
- case 48:
33630
+ case 47:
33557
33631
  if (lastPc) {
33558
33632
  lastPc.close();
33559
33633
  }
33560
- _context6.next = 54;
33634
+ _context6.next = 53;
33561
33635
  break;
33562
- case 51:
33563
- _context6.prev = 51;
33636
+ case 50:
33637
+ _context6.prev = 50;
33564
33638
  _context6.t1 = _context6["catch"](7);
33565
33639
  setTimeout(function() {
33566
33640
  return _this2._emitError(StreamingError$2.create(ERR$2.OTHER, null, _context6.t1));
33567
33641
  });
33568
- case 54:
33642
+ case 53:
33569
33643
  case "end":
33570
33644
  return _context6.stop();
33571
33645
  }
33572
- }, _callee6, this, [[7, 51], [11, 31]]);
33646
+ }, _callee6, this, [[7, 50], [11, 31]]);
33573
33647
  }));
33574
- function load(_x2) {
33648
+ function load(_x2, _x3) {
33575
33649
  return _load.apply(this, arguments);
33576
33650
  }
33577
33651
  return load;
@@ -33580,7 +33654,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33580
33654
  key: "switchURL",
33581
33655
  value: function switchURL(url2) {
33582
33656
  logger$b.log("switchURL()", 'invoked, url: "'.concat(url2, '"'));
33583
- this.load(url2 || this._url);
33657
+ this.load(url2 || this._url, "invoke switchURL");
33584
33658
  }
33585
33659
  }, {
33586
33660
  key: "_bindRTCEvents",
@@ -33604,7 +33678,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33604
33678
  return;
33605
33679
  }
33606
33680
  _this3._retry--;
33607
- _this3.load(_this3._url);
33681
+ _this3.load(_this3._url, "rtc connect failed");
33608
33682
  }
33609
33683
  if (pc.connectionState === "connected") {
33610
33684
  _this3._handleMediaStream();
@@ -33859,7 +33933,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33859
33933
  }
33860
33934
  }, _callee7, this, [[26, 51]]);
33861
33935
  }));
33862
- function _getAnswerSdp(_x3) {
33936
+ function _getAnswerSdp(_x4) {
33863
33937
  return _getAnswerSdp2.apply(this, arguments);
33864
33938
  }
33865
33939
  return _getAnswerSdp;
@@ -33923,7 +33997,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33923
33997
  }
33924
33998
  }, _callee8, this);
33925
33999
  }));
33926
- function _handleAnswerSdp(_x4, _x5) {
34000
+ function _handleAnswerSdp(_x5, _x6) {
33927
34001
  return _handleAnswerSdp2.apply(this, arguments);
33928
34002
  }
33929
34003
  return _handleAnswerSdp;
@@ -33957,7 +34031,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33957
34031
  var report = /* @__PURE__ */ function() {
33958
34032
  var _ref52 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee9() {
33959
34033
  var _this7$_audioTranscei, _this7$_videoTranscei;
33960
- var _yield$Promise$all3, _yield$Promise$all4, curAudioStats, curVideoStats, _this7$_audioStallObs, _this7$_videoStallObs, _this7$_networkQualit, _this7$_networkQualit2, _this7$_media, _this7$_media2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref6, _ref7, quality, qualityInfo, av_sync_diff;
34034
+ var _this7$_frameRecvCall, _yield$Promise$all3, _yield$Promise$all4, curAudioStats, curVideoStats, _this7$_audioStallObs, _this7$_videoStallObs, _this7$_networkQualit, _this7$_networkQualit2, _this7$_media, _this7$_media2, _this7$_media3, _this7$_media4, _this7$_media5, _this7$_media6, _this7$_frameRecvCall2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref6, _ref7, quality, qualityInfo, av_sync_diff;
33961
34035
  return _regeneratorRuntime$a().wrap(function _callee9$(_context9) {
33962
34036
  while (1)
33963
34037
  switch (_context9.prev = _context9.next) {
@@ -33978,35 +34052,39 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
33978
34052
  _this7._videoStallObserver = new VideoStallObserver();
33979
34053
  _this7._videoStallObserver.start(_this7._media);
33980
34054
  }
34055
+ if (!_this7._frameRecvCallback && _this7._media) {
34056
+ _this7._frameRecvCallback = new VideoFrameRecvCallback();
34057
+ (_this7$_frameRecvCall = _this7._frameRecvCallback) === null || _this7$_frameRecvCall === void 0 ? void 0 : _this7$_frameRecvCall.start(_this7._media);
34058
+ }
33981
34059
  if (_this7._pc && !_this7._networkQuality && _this7._opts.enableNetworkQuality && _this7._opts.networkQuality) {
33982
34060
  _this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
33983
34061
  }
33984
- _context9.next = 9;
34062
+ _context9.next = 10;
33985
34063
  return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
33986
- case 9:
34064
+ case 10:
33987
34065
  _yield$Promise$all3 = _context9.sent;
33988
34066
  _yield$Promise$all4 = _slicedToArray$7(_yield$Promise$all3, 2);
33989
34067
  curAudioStats = _yield$Promise$all4[0];
33990
34068
  curVideoStats = _yield$Promise$all4[1];
33991
34069
  if (!(_this7._preAudioStats && _this7._preVideoStats)) {
33992
- _context9.next = 27;
34070
+ _context9.next = 28;
33993
34071
  break;
33994
34072
  }
33995
34073
  audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
33996
34074
  videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
33997
34075
  _this7._videoJitterBufferDelay = videoStats.jitterBufferDelay;
33998
- _context9.next = 19;
34076
+ _context9.next = 20;
33999
34077
  return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
34000
- case 19:
34078
+ case 20:
34001
34079
  audioStallInfo = _context9.sent;
34002
- _context9.next = 22;
34080
+ _context9.next = 23;
34003
34081
  return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
34004
34082
  interval: videoStats.statsInterval,
34005
34083
  frameRateReceived: videoStats.receivedFrameRate,
34006
34084
  frameRateDecoded: videoStats.decoderOutputFrameRate,
34007
34085
  bitrate: videoStats.receivedKBitrate
34008
34086
  });
34009
- case 22:
34087
+ case 23:
34010
34088
  videoStallInfo = _context9.sent;
34011
34089
  _ref6 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$b(_objectSpread2$b({}, audioStats), {}, {
34012
34090
  stallDuration: (audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration) || 0
@@ -34019,7 +34097,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
34019
34097
  if (videoStats.estimatedPlayoutTimestamp && audioStats.estimatedPlayoutTimestamp) {
34020
34098
  av_sync_diff = videoStats.estimatedPlayoutTimestamp - audioStats.estimatedPlayoutTimestamp;
34021
34099
  }
34022
- _this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
34100
+ _this7.emit(EXTEND_EVENTS.RTC_NETWORK, _objectSpread2$b({
34023
34101
  interval: videoStats.statsInterval,
34024
34102
  network_quality: quality,
34025
34103
  audio_stall_duration: audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration,
@@ -34052,13 +34130,23 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
34052
34130
  set_delay_error: _this7._setDelayError || null,
34053
34131
  video_width: ((_this7$_media = _this7._media) === null || _this7$_media === void 0 ? void 0 : _this7$_media.videoWidth) || 0,
34054
34132
  video_height: ((_this7$_media2 = _this7._media) === null || _this7$_media2 === void 0 ? void 0 : _this7$_media2.videoHeight) || 0,
34055
- abr_state: videoStats.abrState || "none"
34056
- });
34057
- case 27:
34133
+ abr_state: videoStats.abrState || "none",
34134
+ recv_frame_rate: videoStats.receivedFrameRate,
34135
+ decode_frame_rate: videoStats.decoderOutputFrameRate,
34136
+ pli: videoStats.pliCount,
34137
+ drop_frame_rate: videoStats.framesDropped,
34138
+ audio_packets_received: audioStats.packetsReceived,
34139
+ video_packets_received: videoStats.packetsReceived,
34140
+ video_muted: (_this7$_media3 = _this7._media) === null || _this7$_media3 === void 0 ? void 0 : _this7$_media3.muted,
34141
+ video_paused: (_this7$_media4 = _this7._media) === null || _this7$_media4 === void 0 ? void 0 : _this7$_media4.paused,
34142
+ video_volume: (_this7$_media5 = _this7._media) === null || _this7$_media5 === void 0 ? void 0 : _this7$_media5.volume,
34143
+ video_current_time: (_this7$_media6 = _this7._media) === null || _this7$_media6 === void 0 ? void 0 : _this7$_media6.currentTime
34144
+ }, ((_this7$_frameRecvCall2 = _this7._frameRecvCallback) === null || _this7$_frameRecvCall2 === void 0 ? void 0 : _this7$_frameRecvCall2.getRecentRenderInfo4Report()) || {}));
34145
+ case 28:
34058
34146
  _this7._preAudioStats = curAudioStats;
34059
34147
  _this7._preVideoStats = curVideoStats;
34060
34148
  _this7._setDelayError = null;
34061
- case 30:
34149
+ case 31:
34062
34150
  case "end":
34063
34151
  return _context9.stop();
34064
34152
  }
@@ -34109,9 +34197,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
34109
34197
  }, {
34110
34198
  key: "_stopRtcReport",
34111
34199
  value: function _stopRtcReport() {
34112
- var _this$_audioStallObse, _this$_videoStallObse, _this$_networkQuality;
34200
+ var _this$_audioStallObse, _this$_videoStallObse, _this$_frameRecvCallb, _this$_networkQuality;
34113
34201
  (_this$_audioStallObse = this._audioStallObserver) === null || _this$_audioStallObse === void 0 ? void 0 : _this$_audioStallObse.destroy();
34114
34202
  (_this$_videoStallObse = this._videoStallObserver) === null || _this$_videoStallObse === void 0 ? void 0 : _this$_videoStallObse.destroy();
34203
+ (_this$_frameRecvCallb = this._frameRecvCallback) === null || _this$_frameRecvCallb === void 0 ? void 0 : _this$_frameRecvCallb.stop();
34204
+ delete this._frameRecvCallback;
34115
34205
  (_this$_networkQuality = this._networkQuality) === null || _this$_networkQuality === void 0 ? void 0 : _this$_networkQuality.destroy();
34116
34206
  delete this._audioStallObserver;
34117
34207
  delete this._videoStallObserver;
@@ -34135,23 +34225,34 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
34135
34225
  }
34136
34226
  }, {
34137
34227
  key: "_disconnect",
34138
- value: function _disconnect() {
34228
+ value: function _disconnect(reason) {
34139
34229
  var _this$_loader2, _this$_networkEvaluat2;
34140
34230
  this._clearDelay();
34231
+ this._clearMediaSrc();
34141
34232
  (_this$_loader2 = this._loader) === null || _this$_loader2 === void 0 ? void 0 : _this$_loader2.cancel();
34142
34233
  (_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
34143
34234
  this._stopRtcReport();
34144
34235
  clearTimeout(this._checkStatsErrorTimer);
34145
34236
  this._clearPeerStateTimeout();
34237
+ this._firstFrameObserver.setFailureReason(reason);
34146
34238
  this._firstFrameObserver.reset();
34147
34239
  this._audioTransceicer = null;
34148
34240
  this._videoTransceicer = null;
34149
34241
  this._mediaStream = null;
34150
34242
  }
34243
+ }, {
34244
+ key: "_clearMediaSrc",
34245
+ value: function _clearMediaSrc() {
34246
+ if (this._media) {
34247
+ this._media.srcObject = null;
34248
+ this._media.removeAttribute("src");
34249
+ }
34250
+ }
34151
34251
  }, {
34152
34252
  key: "_emitError",
34153
34253
  value: function _emitError(error) {
34154
34254
  var _error$originError;
34255
+ logger$b.warn(error);
34155
34256
  this._clearDelay();
34156
34257
  this._firstFrameObserver.setFailureReason((error === null || error === void 0 ? void 0 : (_error$originError = error.originError) === null || _error$originError === void 0 ? void 0 : _error$originError.message) || (error === null || error === void 0 ? void 0 : error.originError) || error);
34157
34258
  this._firstFrameObserver.reset();
@@ -34160,10 +34261,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
34160
34261
  this._clearPeerStateTimeout();
34161
34262
  if (this._pc) {
34162
34263
  this._pc.close();
34163
- if (this._media) {
34164
- this._media.srcObject = null;
34165
- this._media.removeAttribute("src");
34166
- }
34264
+ this._clearMediaSrc();
34167
34265
  }
34168
34266
  }
34169
34267
  }, {
@@ -34265,7 +34363,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
34265
34363
  key: "destroy",
34266
34364
  value: function destroy(keepClearMediaStream) {
34267
34365
  var _this$_revertVolumeWo, _this$_media3;
34268
- this._disconnect();
34366
+ this._disconnect("invoke destroy");
34269
34367
  (_this$_revertVolumeWo = this._revertVolumeWorkaround) === null || _this$_revertVolumeWo === void 0 ? void 0 : _this$_revertVolumeWo.call(this);
34270
34368
  delete this._revertVolumeWorkaround;
34271
34369
  (_this$_media3 = this._media) === null || _this$_media3 === void 0 ? void 0 : _this$_media3.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
@@ -34350,7 +34448,9 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
34350
34448
  _this._rts.load(config2.url);
34351
34449
  };
34352
34450
  _this._onSwitchURL = function(url2) {
34353
- if (url2) {
34451
+ if (url2.startsWith("blob:") || url2 === "") {
34452
+ url2 = _this.player.config.url;
34453
+ } else if (url2) {
34354
34454
  _this.player.config.url = url2;
34355
34455
  }
34356
34456
  if (_this._rts) {
@@ -34359,9 +34459,20 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
34359
34459
  _this._reInit();
34360
34460
  }
34361
34461
  };
34462
+ _this.__retry = function() {
34463
+ _this.player.removeClass(STATE_CLASS$1.ERROR);
34464
+ _this.player.addClass(STATE_CLASS$1.LOADING);
34465
+ runHooks$1(_assertThisInitialized$f(_this), "retry", function() {
34466
+ _this.player.src = "";
34467
+ _this.player.once(CANPLAY, function() {
34468
+ _this.player.mediaPlay();
34469
+ });
34470
+ });
34471
+ };
34362
34472
  _this.destroy = function() {
34363
34473
  var _this$_rts3;
34364
34474
  _this.player.switchURL = _this._originSwitchFn;
34475
+ _this.player.retry = _this._originRetry;
34365
34476
  _this._clearDisconnectTimer();
34366
34477
  (_this$_rts3 = _this._rts) === null || _this$_rts3 === void 0 ? void 0 : _this$_rts3.destroy();
34367
34478
  _this._rts = null;
@@ -34406,7 +34517,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
34406
34517
  }, {
34407
34518
  key: "version",
34408
34519
  get: function get4() {
34409
- return "0.2.1-alpha.51";
34520
+ return "0.2.1-alpha.53";
34410
34521
  }
34411
34522
  }, {
34412
34523
  key: "beforePlayerInit",
@@ -34417,7 +34528,12 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
34417
34528
  var _this$player$switchUR;
34418
34529
  this._originSwitchFn = (_this$player$switchUR = this.player.switchURL) === null || _this$player$switchUR === void 0 ? void 0 : _this$player$switchUR.bind(this.player);
34419
34530
  }
34531
+ if (!this._originRetry) {
34532
+ var _this$player$retry;
34533
+ this._originRetry = (_this$player$retry = this.player.retry) === null || _this$player$retry === void 0 ? void 0 : _this$player$retry.bind(this.player);
34534
+ }
34420
34535
  this.player.switchURL = this._onSwitchURL;
34536
+ this.player.retry = this.__retry;
34421
34537
  (_this$player2 = this.player) === null || _this$player2 === void 0 ? void 0 : _this$player2.useHooks("replay", this._onSwitchURL);
34422
34538
  this.on(URL_CHANGE, this._onSwitchURL);
34423
34539
  this.on(DESTROY, this.destroy);
@@ -34447,6 +34563,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
34447
34563
  if (!((_this2$player = _this2.player) !== null && _this2$player !== void 0 && (_this2$player$video = _this2$player.video) !== null && _this2$player$video !== void 0 && _this2$player$video.srcObject)) {
34448
34564
  _this2.player.video.srcObject = new MediaStream();
34449
34565
  }
34566
+ return "";
34450
34567
  }
34451
34568
  }
34452
34569
  }
@@ -34541,6 +34658,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
34541
34658
  });
34542
34659
  player.unRegisterPlugin("rts");
34543
34660
  player.switchURL = _this3._originSwitchFn;
34661
+ player.retry = _this3._originRetry;
34544
34662
  _this3._rts = null;
34545
34663
  player.rts = null;
34546
34664
  if ((_player$video = player.video) !== null && _player$video !== void 0 && _player$video.srcObject) {