@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.
@@ -51262,6 +51262,7 @@ function getOption(opts) {
51262
51262
  checkStatsErrorDelay: 5e3,
51263
51263
  connectionStateChangeTimeout: 5e3,
51264
51264
  enableNetworkQuality: false,
51265
+ hackCreateOfferIssue: false,
51265
51266
  networkQuality: {
51266
51267
  networkQos: {
51267
51268
  1: {
@@ -53227,26 +53228,33 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53227
53228
  }
53228
53229
  encodedTransformSupported = isLegacyEncodedTransformSupported();
53229
53230
  _context3.prev = 6;
53231
+ if (!this._opts.hackCreateOfferIssue) {
53232
+ _context3.next = 10;
53233
+ break;
53234
+ }
53235
+ _context3.next = 10;
53236
+ return this._createEmptyPeer();
53237
+ case 10:
53230
53238
  this._pc = new RTCPeerConnection({
53231
53239
  encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
53232
53240
  });
53233
53241
  this._bindRTCEvents();
53234
- _context3.next = 11;
53242
+ _context3.next = 14;
53235
53243
  return this._connect(url2);
53236
- case 11:
53237
- _context3.next = 16;
53244
+ case 14:
53245
+ _context3.next = 19;
53238
53246
  break;
53239
- case 13:
53240
- _context3.prev = 13;
53247
+ case 16:
53248
+ _context3.prev = 16;
53241
53249
  _context3.t0 = _context3["catch"](6);
53242
53250
  setTimeout(function() {
53243
53251
  return _this2._emitError(StreamingError$2.create(ERR$2.OTHER, null, _context3.t0));
53244
53252
  });
53245
- case 16:
53253
+ case 19:
53246
53254
  case "end":
53247
53255
  return _context3.stop();
53248
53256
  }
53249
- }, _callee3, this, [[6, 13]]);
53257
+ }, _callee3, this, [[6, 16]]);
53250
53258
  }));
53251
53259
  function load(_x) {
53252
53260
  return _load.apply(this, arguments);
@@ -53424,6 +53432,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53424
53432
  case 13:
53425
53433
  offer = _context4.sent;
53426
53434
  case 14:
53435
+ if (this._opts.hackCreateOfferIssue) {
53436
+ this._createEmptyPeer();
53437
+ }
53427
53438
  logger$a.log("local offer");
53428
53439
  logger$a.log(offer.sdp);
53429
53440
  parsed = lib$1.parse(offer.sdp);
@@ -53448,11 +53459,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53448
53459
  });
53449
53460
  offer.sdp = lib$1.write(parsed);
53450
53461
  logger$a.log("local offer modified:\n", offer.sdp);
53451
- _context4.next = 22;
53462
+ _context4.next = 23;
53452
53463
  return pc.setLocalDescription(offer);
53453
- case 22:
53464
+ case 23:
53454
53465
  finnalUrl = this._url;
53455
- _context4.prev = 23;
53466
+ _context4.prev = 24;
53456
53467
  if (this._opts.preProcessUrl) {
53457
53468
  finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
53458
53469
  }
@@ -53465,7 +53476,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53465
53476
  sessionId
53466
53477
  });
53467
53478
  reqStart = Date.now();
53468
- _context4.next = 32;
53479
+ _context4.next = 33;
53469
53480
  return this._loader.load(finnalUrl, {
53470
53481
  body: JSON.stringify({
53471
53482
  sessionId,
@@ -53473,27 +53484,27 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53473
53484
  localSdp: offer
53474
53485
  })
53475
53486
  });
53476
- case 32:
53487
+ case 33:
53477
53488
  res = _context4.sent;
53478
53489
  this.emit(EVENT$2.LOAD_RESPONSE_HEADERS, {
53479
53490
  headers: res.response.headers
53480
53491
  });
53481
53492
  answer = res === null || res === void 0 ? void 0 : res.data;
53482
53493
  if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
53483
- _context4.next = 40;
53494
+ _context4.next = 41;
53484
53495
  break;
53485
53496
  }
53486
53497
  err = StreamingError$2.create(answer.code === 404 ? ERR$2.NETWORK_NOTFOUND : ERR$2.NETWORK_FORBIDDEN, null, answer);
53487
53498
  err.errorType = ERR$2.NETWORK;
53488
53499
  this._emitError(err);
53489
53500
  return _context4.abrupt("return");
53490
- case 40:
53501
+ case 41:
53491
53502
  if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
53492
- _context4.next = 42;
53503
+ _context4.next = 43;
53493
53504
  break;
53494
53505
  }
53495
53506
  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));
53496
- case 42:
53507
+ case 43:
53497
53508
  logger$a.log("answer:");
53498
53509
  logger$a.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
53499
53510
  _parsed = lib$1.parse(answer.remoteSdp.sdp);
@@ -53522,22 +53533,22 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53522
53533
  answer.remoteSdp.sdp = lib$1.write(_parsed);
53523
53534
  logger$a.log("answer modified:\n", answer.remoteSdp.sdp);
53524
53535
  this._rctConnectStartTs = Date.now();
53525
- _context4.next = 52;
53536
+ _context4.next = 53;
53526
53537
  return this._pc.setRemoteDescription(answer.remoteSdp);
53527
- case 52:
53538
+ case 53:
53528
53539
  this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
53529
53540
  this._listenPeerStateTimeout();
53530
- _context4.next = 59;
53541
+ _context4.next = 60;
53531
53542
  break;
53532
- case 56:
53533
- _context4.prev = 56;
53534
- _context4.t0 = _context4["catch"](23);
53543
+ case 57:
53544
+ _context4.prev = 57;
53545
+ _context4.t0 = _context4["catch"](24);
53535
53546
  this._emitError(StreamingError$2.network(_context4.t0));
53536
- case 59:
53547
+ case 60:
53537
53548
  case "end":
53538
53549
  return _context4.stop();
53539
53550
  }
53540
- }, _callee4, this, [[23, 56]]);
53551
+ }, _callee4, this, [[24, 57]]);
53541
53552
  }));
53542
53553
  function _connect() {
53543
53554
  return _connect2.apply(this, arguments);
@@ -53720,6 +53731,32 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
53720
53731
  this._pc.close();
53721
53732
  }
53722
53733
  }
53734
+ }, {
53735
+ key: "_createEmptyPeer",
53736
+ value: function() {
53737
+ var _createEmptyPeer2 = _asyncToGenerator$a(/* @__PURE__ */ _regeneratorRuntime$a().mark(function _callee6() {
53738
+ var pc;
53739
+ return _regeneratorRuntime$a().wrap(function _callee6$(_context6) {
53740
+ while (1)
53741
+ switch (_context6.prev = _context6.next) {
53742
+ case 0:
53743
+ pc = new RTCPeerConnection();
53744
+ _context6.next = 3;
53745
+ return pc.createOffer();
53746
+ case 3:
53747
+ pc.close();
53748
+ pc = null;
53749
+ case 5:
53750
+ case "end":
53751
+ return _context6.stop();
53752
+ }
53753
+ }, _callee6);
53754
+ }));
53755
+ function _createEmptyPeer() {
53756
+ return _createEmptyPeer2.apply(this, arguments);
53757
+ }
53758
+ return _createEmptyPeer;
53759
+ }()
53723
53760
  }, {
53724
53761
  key: "destroy",
53725
53762
  value: function destroy2(keepClearMediaStream) {
@@ -53860,7 +53897,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
53860
53897
  }, {
53861
53898
  key: "version",
53862
53899
  get: function get4() {
53863
- return "0.2.1-alpha.34";
53900
+ return "0.2.1-alpha.35";
53864
53901
  }
53865
53902
  }, {
53866
53903
  key: "beforePlayerInit",