@byteplus/veplayer-plugin 2.8.0-rc.7 → 2.8.0-rc.8

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.
@@ -4958,6 +4958,7 @@ function getOption(opts) {
4958
4958
  checkStatsErrorDelay: 5e3,
4959
4959
  connectionStateChangeTimeout: 5e3,
4960
4960
  enableNetworkQuality: false,
4961
+ hackCreateOfferIssue: false,
4961
4962
  networkQuality: {
4962
4963
  networkQos: {
4963
4964
  1: {
@@ -6923,26 +6924,33 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
6923
6924
  }
6924
6925
  encodedTransformSupported = isLegacyEncodedTransformSupported();
6925
6926
  _context3.prev = 6;
6927
+ if (!this._opts.hackCreateOfferIssue) {
6928
+ _context3.next = 10;
6929
+ break;
6930
+ }
6931
+ _context3.next = 10;
6932
+ return this._createEmptyPeer();
6933
+ case 10:
6926
6934
  this._pc = new RTCPeerConnection({
6927
6935
  encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
6928
6936
  });
6929
6937
  this._bindRTCEvents();
6930
- _context3.next = 11;
6938
+ _context3.next = 14;
6931
6939
  return this._connect(url);
6932
- case 11:
6933
- _context3.next = 16;
6940
+ case 14:
6941
+ _context3.next = 19;
6934
6942
  break;
6935
- case 13:
6936
- _context3.prev = 13;
6943
+ case 16:
6944
+ _context3.prev = 16;
6937
6945
  _context3.t0 = _context3["catch"](6);
6938
6946
  setTimeout(function() {
6939
6947
  return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
6940
6948
  });
6941
- case 16:
6949
+ case 19:
6942
6950
  case "end":
6943
6951
  return _context3.stop();
6944
6952
  }
6945
- }, _callee3, this, [[6, 13]]);
6953
+ }, _callee3, this, [[6, 16]]);
6946
6954
  }));
6947
6955
  function load(_x) {
6948
6956
  return _load.apply(this, arguments);
@@ -7120,6 +7128,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7120
7128
  case 13:
7121
7129
  offer = _context4.sent;
7122
7130
  case 14:
7131
+ if (this._opts.hackCreateOfferIssue) {
7132
+ this._createEmptyPeer();
7133
+ }
7123
7134
  logger.log("local offer");
7124
7135
  logger.log(offer.sdp);
7125
7136
  parsed = lib.parse(offer.sdp);
@@ -7144,11 +7155,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7144
7155
  });
7145
7156
  offer.sdp = lib.write(parsed);
7146
7157
  logger.log("local offer modified:\n", offer.sdp);
7147
- _context4.next = 22;
7158
+ _context4.next = 23;
7148
7159
  return pc.setLocalDescription(offer);
7149
- case 22:
7160
+ case 23:
7150
7161
  finnalUrl = this._url;
7151
- _context4.prev = 23;
7162
+ _context4.prev = 24;
7152
7163
  if (this._opts.preProcessUrl) {
7153
7164
  finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
7154
7165
  }
@@ -7161,7 +7172,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7161
7172
  sessionId
7162
7173
  });
7163
7174
  reqStart = Date.now();
7164
- _context4.next = 32;
7175
+ _context4.next = 33;
7165
7176
  return this._loader.load(finnalUrl, {
7166
7177
  body: JSON.stringify({
7167
7178
  sessionId,
@@ -7169,27 +7180,27 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7169
7180
  localSdp: offer
7170
7181
  })
7171
7182
  });
7172
- case 32:
7183
+ case 33:
7173
7184
  res = _context4.sent;
7174
7185
  this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
7175
7186
  headers: res.response.headers
7176
7187
  });
7177
7188
  answer = res === null || res === void 0 ? void 0 : res.data;
7178
7189
  if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
7179
- _context4.next = 40;
7190
+ _context4.next = 41;
7180
7191
  break;
7181
7192
  }
7182
7193
  err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
7183
7194
  err.errorType = ERR.NETWORK;
7184
7195
  this._emitError(err);
7185
7196
  return _context4.abrupt("return");
7186
- case 40:
7197
+ case 41:
7187
7198
  if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
7188
- _context4.next = 42;
7199
+ _context4.next = 43;
7189
7200
  break;
7190
7201
  }
7191
7202
  throw new Error("code: ".concat(answer === null || answer === void 0 ? void 0 : answer.code, ", message:").concat(answer === null || answer === void 0 ? void 0 : answer.message));
7192
- case 42:
7203
+ case 43:
7193
7204
  logger.log("answer:");
7194
7205
  logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
7195
7206
  _parsed = lib.parse(answer.remoteSdp.sdp);
@@ -7218,22 +7229,22 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7218
7229
  answer.remoteSdp.sdp = lib.write(_parsed);
7219
7230
  logger.log("answer modified:\n", answer.remoteSdp.sdp);
7220
7231
  this._rctConnectStartTs = Date.now();
7221
- _context4.next = 52;
7232
+ _context4.next = 53;
7222
7233
  return this._pc.setRemoteDescription(answer.remoteSdp);
7223
- case 52:
7234
+ case 53:
7224
7235
  this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
7225
7236
  this._listenPeerStateTimeout();
7226
- _context4.next = 59;
7237
+ _context4.next = 60;
7227
7238
  break;
7228
- case 56:
7229
- _context4.prev = 56;
7230
- _context4.t0 = _context4["catch"](23);
7239
+ case 57:
7240
+ _context4.prev = 57;
7241
+ _context4.t0 = _context4["catch"](24);
7231
7242
  this._emitError(StreamingError.network(_context4.t0));
7232
- case 59:
7243
+ case 60:
7233
7244
  case "end":
7234
7245
  return _context4.stop();
7235
7246
  }
7236
- }, _callee4, this, [[23, 56]]);
7247
+ }, _callee4, this, [[24, 57]]);
7237
7248
  }));
7238
7249
  function _connect() {
7239
7250
  return _connect2.apply(this, arguments);
@@ -7416,6 +7427,32 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
7416
7427
  this._pc.close();
7417
7428
  }
7418
7429
  }
7430
+ }, {
7431
+ key: "_createEmptyPeer",
7432
+ value: function() {
7433
+ var _createEmptyPeer2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6() {
7434
+ var pc;
7435
+ return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
7436
+ while (1)
7437
+ switch (_context6.prev = _context6.next) {
7438
+ case 0:
7439
+ pc = new RTCPeerConnection();
7440
+ _context6.next = 3;
7441
+ return pc.createOffer();
7442
+ case 3:
7443
+ pc.close();
7444
+ pc = null;
7445
+ case 5:
7446
+ case "end":
7447
+ return _context6.stop();
7448
+ }
7449
+ }, _callee6);
7450
+ }));
7451
+ function _createEmptyPeer() {
7452
+ return _createEmptyPeer2.apply(this, arguments);
7453
+ }
7454
+ return _createEmptyPeer;
7455
+ }()
7419
7456
  }, {
7420
7457
  key: "destroy",
7421
7458
  value: function destroy(keepClearMediaStream) {
@@ -7556,7 +7593,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
7556
7593
  }, {
7557
7594
  key: "version",
7558
7595
  get: function get() {
7559
- return "0.2.1-alpha.34";
7596
+ return "0.2.1-alpha.35";
7560
7597
  }
7561
7598
  }, {
7562
7599
  key: "beforePlayerInit",