@eyepop.ai/eyepop 1.11.4 → 1.11.6

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.
@@ -9130,6 +9130,21 @@ var WebrtcBase = class _WebrtcBase {
9130
9130
  ingressId() {
9131
9131
  return this._ingressId;
9132
9132
  }
9133
+ gresUrl(session, location = null) {
9134
+ let urlPath;
9135
+ if (location) {
9136
+ urlPath = path.join(this._urlPath, location);
9137
+ } else {
9138
+ urlPath = this._urlPath;
9139
+ }
9140
+ let baseUrl;
9141
+ if (session.baseUrl?.endsWith("/")) {
9142
+ baseUrl = session.baseUrl;
9143
+ } else {
9144
+ baseUrl = session.baseUrl + "/";
9145
+ }
9146
+ return new URL(urlPath, baseUrl);
9147
+ }
9133
9148
  async onLocalOffer(offer) {
9134
9149
  if (!this._pc) {
9135
9150
  throw new Error("onLocalOffer no peer connection");
@@ -9140,7 +9155,7 @@ var WebrtcBase = class _WebrtcBase {
9140
9155
  this._offerData = _WebrtcBase.parseOffer(offer.sdp);
9141
9156
  await this._pc.setLocalDescription(offer);
9142
9157
  const session = await this._getSession();
9143
- const ingressUrl = new URL(this._urlPath, session.baseUrl);
9158
+ const ingressUrl = this.gresUrl(session);
9144
9159
  this._requestLogger.debug("before POST: %s", ingressUrl);
9145
9160
  const headers = {
9146
9161
  ...session.authenticationHeaders(),
@@ -9169,12 +9184,7 @@ var WebrtcBase = class _WebrtcBase {
9169
9184
  }
9170
9185
  let urlPath = void 0;
9171
9186
  const session = await this._getSession();
9172
- if (this._location) {
9173
- urlPath = path.join(this._urlPath, this._location);
9174
- } else {
9175
- urlPath = this._urlPath;
9176
- }
9177
- const ingressUrl = new URL(urlPath, session.baseUrl);
9187
+ const ingressUrl = this.gresUrl(session, this._location);
9178
9188
  this._requestLogger.debug("before PATCH: %s", ingressUrl);
9179
9189
  const headers = {
9180
9190
  ...session.authenticationHeaders(),
@@ -9351,12 +9361,12 @@ var WebrtcBase = class _WebrtcBase {
9351
9361
  // worker/webrtc_whip.ts
9352
9362
  var WebrtcWhip = class extends WebrtcBase {
9353
9363
  constructor(stream, getSession, client, requestLogger) {
9354
- super(getSession, client, uuidv4().toString(), "/liveIngress/whip", requestLogger);
9364
+ super(getSession, client, uuidv4().toString(), "liveIngress/whip", requestLogger);
9355
9365
  this._stream = stream;
9356
9366
  }
9357
9367
  async start() {
9358
9368
  const session = await this._getSession();
9359
- const ingressUrl = new URL(this._urlPath, session.baseUrl);
9369
+ const ingressUrl = this.gresUrl(session);
9360
9370
  this._requestLogger.debug("before GET: %s", ingressUrl);
9361
9371
  const response = await this._client.fetch(ingressUrl, {
9362
9372
  headers: session.authenticationHeaders(),
@@ -9434,7 +9444,7 @@ var WebrtcWhip = class extends WebrtcBase {
9434
9444
  // worker/webrtc_whep.ts
9435
9445
  var WebrtcWhep = class extends WebrtcBase {
9436
9446
  constructor(ingressId, getSession, client, requestLogger) {
9437
- super(getSession, client, ingressId, "/liveIngress/whep", requestLogger);
9447
+ super(getSession, client, ingressId, "liveIngress/whep", requestLogger);
9438
9448
  this._stream = null;
9439
9449
  }
9440
9450
  async close() {
@@ -9457,7 +9467,7 @@ var WebrtcWhep = class extends WebrtcBase {
9457
9467
  }
9458
9468
  async start() {
9459
9469
  const session = await this._getSession();
9460
- const egressUrl = new URL(this._urlPath, session.baseUrl);
9470
+ const egressUrl = this.gresUrl(session);
9461
9471
  this._requestLogger.debug("before GET: %s", egressUrl);
9462
9472
  const response = await this._client.fetch(egressUrl, {
9463
9473
  headers: session.authenticationHeaders(),
@@ -9571,8 +9581,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9571
9581
  console.debug("EyePop: creating HttpClient in browser");
9572
9582
  return new BrowserHttpClient();
9573
9583
  };
9574
- }
9575
- if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9584
+ } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9576
9585
  class ReactNativeHttpClient {
9577
9586
  constructor() {
9578
9587
  }