@eyepop.ai/eyepop 1.14.2 → 1.14.4

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.
@@ -9241,7 +9241,7 @@ var WebrtcBase = class _WebrtcBase {
9241
9241
  await this._pc.setLocalDescription(offer);
9242
9242
  const session = await this._getSession();
9243
9243
  const ingressUrl = this.gresUrl(session);
9244
- this._requestLogger.debug("before POST: %s", ingressUrl);
9244
+ this._requestLogger.debug(`before POST: ${ingressUrl}`);
9245
9245
  const headers = {
9246
9246
  ...session.authenticationHeaders(),
9247
9247
  "Content-Type": "application/sdp"
@@ -9251,17 +9251,16 @@ var WebrtcBase = class _WebrtcBase {
9251
9251
  method: "POST",
9252
9252
  body: offer.sdp
9253
9253
  });
9254
+ this._requestLogger.debug(`after POST: ${ingressUrl} status: ${response.status}`);
9254
9255
  if (response.status != 201) {
9255
9256
  return Promise.reject(`unknown status code for POST '${ingressUrl}': ${response.status} (${response.statusText})`);
9256
9257
  }
9257
9258
  this._eTag = response.headers.get("ETag") ?? "";
9258
9259
  this._location = response.headers.get("Location");
9259
- return this.onRemoteAnswer(
9260
- new RTCSessionDescription({
9261
- type: "answer",
9262
- sdp: await response.text()
9263
- })
9264
- );
9260
+ return await this.onRemoteAnswer(new RTCSessionDescription({
9261
+ type: "answer",
9262
+ sdp: await response.text()
9263
+ }));
9265
9264
  }
9266
9265
  async sendLocalCandidates(candidates) {
9267
9266
  if (!this._offerData) {
@@ -9460,7 +9459,7 @@ var WebrtcWhip = class extends WebrtcBase {
9460
9459
  if (response.status >= 300) {
9461
9460
  return Promise.reject(`unknown status code for GET '${ingressUrl}': ${response.status} (${response.statusText})`);
9462
9461
  }
9463
- return this.onIceServers(response);
9462
+ return await this.onIceServers(response);
9464
9463
  }
9465
9464
  async stream() {
9466
9465
  if (this._stream) {
@@ -9616,13 +9615,13 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9616
9615
  throw new DOMException("resolving a path to a file is not supported in browser");
9617
9616
  };
9618
9617
  } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9619
- let RNFSName = "react-native-fs";
9620
- let RNFS;
9621
- let RNFSLoadError;
9618
+ let RNFAName = "react-native-file-access";
9619
+ let RNFA;
9620
+ let RNFALoadError;
9622
9621
  try {
9623
- RNFS = __require(RNFSName);
9622
+ RNFA = __require(RNFAName);
9624
9623
  } catch (e) {
9625
- RNFSLoadError = e;
9624
+ RNFALoadError = e;
9626
9625
  }
9627
9626
  let EFSName = "expo-file-system";
9628
9627
  let EFS;
@@ -9633,19 +9632,21 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9633
9632
  EFSLoadError = e;
9634
9633
  }
9635
9634
  resolvePath = async (source, logger) => {
9636
- if (RNFS?.read !== void 0) {
9637
- logger.debug("Using react-native-fs to read local file");
9635
+ if (RNFA?.FileSystem?.readFileChunk !== void 0) {
9636
+ logger.debug("Using react-native-file-access to read local file");
9638
9637
  const bufferSize = 1024 * 1024;
9639
9638
  let pos = 0;
9639
+ const size = (await RNFA.FileSystem.stat(source.path)).size;
9640
9640
  let eof = false;
9641
9641
  const stream = new ReadableStream({
9642
9642
  async pull(controller) {
9643
9643
  if (eof) {
9644
9644
  return;
9645
9645
  }
9646
- const chunkAsB64 = await RNFS.read(source.path, bufferSize, pos, "base64");
9646
+ const chunkSize = Math.min(bufferSize, size - pos);
9647
+ const chunkAsB64 = await RNFA.FileSystem.readFileChunk(source.path, pos, chunkSize, "base64");
9647
9648
  if (chunkAsB64.length > 0) {
9648
- const chunk = Buffer.from(chunkAsB64, "base64");
9649
+ const chunk = Buffer.from(chunkAsB64, "base64").subarray(0, chunkSize);
9649
9650
  controller.enqueue(chunk);
9650
9651
  pos += chunk.length;
9651
9652
  } else {
@@ -9656,12 +9657,14 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9656
9657
  });
9657
9658
  return {
9658
9659
  stream,
9659
- size: (await RNFS.stat(source.path)).size,
9660
+ size,
9660
9661
  mimeType: source.mimeType || "image/*"
9661
9662
  };
9662
- } else if (EFS?.readAsStringAsync !== void 0) {
9663
+ }
9664
+ if (EFS?.readAsStringAsync !== void 0) {
9663
9665
  logger.debug("Using expo-file-system to read local file");
9664
9666
  const bufferSize = 1024 * 1024;
9667
+ const size = (await EFS.getInfoAsync(`file://${source.path}`)).size;
9665
9668
  let pos = 0;
9666
9669
  let eof = false;
9667
9670
  const stream = new ReadableStream({
@@ -9669,8 +9672,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9669
9672
  if (eof) {
9670
9673
  return;
9671
9674
  }
9675
+ const chunkSize = Math.min(bufferSize, size - pos);
9672
9676
  const chunkAsB64 = await EFS.readAsStringAsync(`file://${source.path}`, {
9673
- length: bufferSize,
9677
+ length: chunkSize,
9674
9678
  position: pos,
9675
9679
  encoding: "base64"
9676
9680
  });
@@ -9686,11 +9690,11 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9686
9690
  });
9687
9691
  return {
9688
9692
  stream,
9689
- size: (await EFS.getInfoAsync(`file://${source.path}`)).size,
9693
+ size,
9690
9694
  mimeType: source.mimeType || "image/*"
9691
9695
  };
9692
9696
  }
9693
- return Promise.reject(`Could not load '${RNFSName}' (reason" ${RNFSLoadError}) or '${EFSName}' (reason" ${EFSLoadError}), include either of those packages in your application to enable uploads via PathSource - or provide the stream itself via StreamSource.`);
9697
+ throw new Error(`Could not load '${RNFAName}' (reason" ${RNFALoadError}) or '${EFSName}' (reason" ${EFSLoadError}). Falling back to fetch() which might cause memory issues. Include either of those packages in your application to enable uploads via PathSource - or provide the stream itself via StreamSource.We will try to load file://${source.path} via fetch()`);
9694
9698
  };
9695
9699
  } else {
9696
9700
  let iteratorToStream = function(iterator) {
@@ -10174,6 +10178,13 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
10174
10178
  }
10175
10179
  } else if (init?.body instanceof ReadableStream) {
10176
10180
  streamBody = init.body;
10181
+ } else if (typeof init?.body === "string") {
10182
+ streamBody = new ReadableStream({
10183
+ start: (controller) => {
10184
+ controller.enqueue(Buffer.from(init?.body, "utf8"));
10185
+ controller.close();
10186
+ }
10187
+ });
10177
10188
  }
10178
10189
  if (streamBody) {
10179
10190
  if (TcpSockets?.TLSSocket !== void 0) {