@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.
@@ -861,6 +861,7 @@ declare abstract class WebrtcBase {
861
861
  constructor(getSession: () => Promise<WorkerSession>, client: HttpClient, ingressId: string, urlBasePath: string, requestLogger: Logger);
862
862
  close(): Promise<void>;
863
863
  ingressId(): string;
864
+ protected gresUrl(session: WorkerSession, location?: string | null): URL;
864
865
  protected onLocalOffer(offer: RTCSessionDescriptionInit): Promise<WebrtcBase>;
865
866
  protected abstract onRemoteAnswer(answer: RTCSessionDescription): Promise<WebrtcBase>;
866
867
  protected sendLocalCandidates(candidates: RTCIceCandidate[]): Promise<WebrtcBase>;
@@ -861,6 +861,7 @@ declare abstract class WebrtcBase {
861
861
  constructor(getSession: () => Promise<WorkerSession>, client: HttpClient, ingressId: string, urlBasePath: string, requestLogger: Logger);
862
862
  close(): Promise<void>;
863
863
  ingressId(): string;
864
+ protected gresUrl(session: WorkerSession, location?: string | null): URL;
864
865
  protected onLocalOffer(offer: RTCSessionDescriptionInit): Promise<WebrtcBase>;
865
866
  protected abstract onRemoteAnswer(answer: RTCSessionDescription): Promise<WebrtcBase>;
866
867
  protected sendLocalCandidates(candidates: RTCIceCandidate[]): Promise<WebrtcBase>;
@@ -9192,6 +9192,21 @@ var WebrtcBase = class _WebrtcBase {
9192
9192
  ingressId() {
9193
9193
  return this._ingressId;
9194
9194
  }
9195
+ gresUrl(session, location = null) {
9196
+ let urlPath;
9197
+ if (location) {
9198
+ urlPath = import_path.default.join(this._urlPath, location);
9199
+ } else {
9200
+ urlPath = this._urlPath;
9201
+ }
9202
+ let baseUrl;
9203
+ if (session.baseUrl?.endsWith("/")) {
9204
+ baseUrl = session.baseUrl;
9205
+ } else {
9206
+ baseUrl = session.baseUrl + "/";
9207
+ }
9208
+ return new URL(urlPath, baseUrl);
9209
+ }
9195
9210
  async onLocalOffer(offer) {
9196
9211
  if (!this._pc) {
9197
9212
  throw new Error("onLocalOffer no peer connection");
@@ -9202,7 +9217,7 @@ var WebrtcBase = class _WebrtcBase {
9202
9217
  this._offerData = _WebrtcBase.parseOffer(offer.sdp);
9203
9218
  await this._pc.setLocalDescription(offer);
9204
9219
  const session = await this._getSession();
9205
- const ingressUrl = new URL(this._urlPath, session.baseUrl);
9220
+ const ingressUrl = this.gresUrl(session);
9206
9221
  this._requestLogger.debug("before POST: %s", ingressUrl);
9207
9222
  const headers = {
9208
9223
  ...session.authenticationHeaders(),
@@ -9231,12 +9246,7 @@ var WebrtcBase = class _WebrtcBase {
9231
9246
  }
9232
9247
  let urlPath = void 0;
9233
9248
  const session = await this._getSession();
9234
- if (this._location) {
9235
- urlPath = import_path.default.join(this._urlPath, this._location);
9236
- } else {
9237
- urlPath = this._urlPath;
9238
- }
9239
- const ingressUrl = new URL(urlPath, session.baseUrl);
9249
+ const ingressUrl = this.gresUrl(session, this._location);
9240
9250
  this._requestLogger.debug("before PATCH: %s", ingressUrl);
9241
9251
  const headers = {
9242
9252
  ...session.authenticationHeaders(),
@@ -9413,12 +9423,12 @@ var WebrtcBase = class _WebrtcBase {
9413
9423
  // worker/webrtc_whip.ts
9414
9424
  var WebrtcWhip = class extends WebrtcBase {
9415
9425
  constructor(stream, getSession, client, requestLogger) {
9416
- super(getSession, client, (0, import_uuid.v4)().toString(), "/liveIngress/whip", requestLogger);
9426
+ super(getSession, client, (0, import_uuid.v4)().toString(), "liveIngress/whip", requestLogger);
9417
9427
  this._stream = stream;
9418
9428
  }
9419
9429
  async start() {
9420
9430
  const session = await this._getSession();
9421
- const ingressUrl = new URL(this._urlPath, session.baseUrl);
9431
+ const ingressUrl = this.gresUrl(session);
9422
9432
  this._requestLogger.debug("before GET: %s", ingressUrl);
9423
9433
  const response = await this._client.fetch(ingressUrl, {
9424
9434
  headers: session.authenticationHeaders(),
@@ -9496,7 +9506,7 @@ var WebrtcWhip = class extends WebrtcBase {
9496
9506
  // worker/webrtc_whep.ts
9497
9507
  var WebrtcWhep = class extends WebrtcBase {
9498
9508
  constructor(ingressId, getSession, client, requestLogger) {
9499
- super(getSession, client, ingressId, "/liveIngress/whep", requestLogger);
9509
+ super(getSession, client, ingressId, "liveIngress/whep", requestLogger);
9500
9510
  this._stream = null;
9501
9511
  }
9502
9512
  async close() {
@@ -9519,7 +9529,7 @@ var WebrtcWhep = class extends WebrtcBase {
9519
9529
  }
9520
9530
  async start() {
9521
9531
  const session = await this._getSession();
9522
- const egressUrl = new URL(this._urlPath, session.baseUrl);
9532
+ const egressUrl = this.gresUrl(session);
9523
9533
  this._requestLogger.debug("before GET: %s", egressUrl);
9524
9534
  const response = await this._client.fetch(egressUrl, {
9525
9535
  headers: session.authenticationHeaders(),
@@ -9633,8 +9643,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9633
9643
  console.debug("EyePop: creating HttpClient in browser");
9634
9644
  return new BrowserHttpClient();
9635
9645
  };
9636
- }
9637
- if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9646
+ } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9638
9647
  class ReactNativeHttpClient {
9639
9648
  constructor() {
9640
9649
  }