@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.
@@ -9306,7 +9306,7 @@ var WebrtcBase = class _WebrtcBase {
9306
9306
  await this._pc.setLocalDescription(offer);
9307
9307
  const session = await this._getSession();
9308
9308
  const ingressUrl = this.gresUrl(session);
9309
- this._requestLogger.debug("before POST: %s", ingressUrl);
9309
+ this._requestLogger.debug(`before POST: ${ingressUrl}`);
9310
9310
  const headers = {
9311
9311
  ...session.authenticationHeaders(),
9312
9312
  "Content-Type": "application/sdp"
@@ -9316,17 +9316,16 @@ var WebrtcBase = class _WebrtcBase {
9316
9316
  method: "POST",
9317
9317
  body: offer.sdp
9318
9318
  });
9319
+ this._requestLogger.debug(`after POST: ${ingressUrl} status: ${response.status}`);
9319
9320
  if (response.status != 201) {
9320
9321
  return Promise.reject(`unknown status code for POST '${ingressUrl}': ${response.status} (${response.statusText})`);
9321
9322
  }
9322
9323
  this._eTag = response.headers.get("ETag") ?? "";
9323
9324
  this._location = response.headers.get("Location");
9324
- return this.onRemoteAnswer(
9325
- new RTCSessionDescription({
9326
- type: "answer",
9327
- sdp: await response.text()
9328
- })
9329
- );
9325
+ return await this.onRemoteAnswer(new RTCSessionDescription({
9326
+ type: "answer",
9327
+ sdp: await response.text()
9328
+ }));
9330
9329
  }
9331
9330
  async sendLocalCandidates(candidates) {
9332
9331
  if (!this._offerData) {
@@ -9525,7 +9524,7 @@ var WebrtcWhip = class extends WebrtcBase {
9525
9524
  if (response.status >= 300) {
9526
9525
  return Promise.reject(`unknown status code for GET '${ingressUrl}': ${response.status} (${response.statusText})`);
9527
9526
  }
9528
- return this.onIceServers(response);
9527
+ return await this.onIceServers(response);
9529
9528
  }
9530
9529
  async stream() {
9531
9530
  if (this._stream) {
@@ -9681,13 +9680,13 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9681
9680
  throw new DOMException("resolving a path to a file is not supported in browser");
9682
9681
  };
9683
9682
  } else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
9684
- let RNFSName = "react-native-fs";
9685
- let RNFS;
9686
- let RNFSLoadError;
9683
+ let RNFAName = "react-native-file-access";
9684
+ let RNFA;
9685
+ let RNFALoadError;
9687
9686
  try {
9688
- RNFS = require(RNFSName);
9687
+ RNFA = require(RNFAName);
9689
9688
  } catch (e) {
9690
- RNFSLoadError = e;
9689
+ RNFALoadError = e;
9691
9690
  }
9692
9691
  let EFSName = "expo-file-system";
9693
9692
  let EFS;
@@ -9698,19 +9697,21 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9698
9697
  EFSLoadError = e;
9699
9698
  }
9700
9699
  resolvePath = async (source, logger) => {
9701
- if (RNFS?.read !== void 0) {
9702
- logger.debug("Using react-native-fs to read local file");
9700
+ if (RNFA?.FileSystem?.readFileChunk !== void 0) {
9701
+ logger.debug("Using react-native-file-access to read local file");
9703
9702
  const bufferSize = 1024 * 1024;
9704
9703
  let pos = 0;
9704
+ const size = (await RNFA.FileSystem.stat(source.path)).size;
9705
9705
  let eof = false;
9706
9706
  const stream = new ReadableStream({
9707
9707
  async pull(controller) {
9708
9708
  if (eof) {
9709
9709
  return;
9710
9710
  }
9711
- const chunkAsB64 = await RNFS.read(source.path, bufferSize, pos, "base64");
9711
+ const chunkSize = Math.min(bufferSize, size - pos);
9712
+ const chunkAsB64 = await RNFA.FileSystem.readFileChunk(source.path, pos, chunkSize, "base64");
9712
9713
  if (chunkAsB64.length > 0) {
9713
- const chunk = Buffer.from(chunkAsB64, "base64");
9714
+ const chunk = Buffer.from(chunkAsB64, "base64").subarray(0, chunkSize);
9714
9715
  controller.enqueue(chunk);
9715
9716
  pos += chunk.length;
9716
9717
  } else {
@@ -9721,12 +9722,14 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9721
9722
  });
9722
9723
  return {
9723
9724
  stream,
9724
- size: (await RNFS.stat(source.path)).size,
9725
+ size,
9725
9726
  mimeType: source.mimeType || "image/*"
9726
9727
  };
9727
- } else if (EFS?.readAsStringAsync !== void 0) {
9728
+ }
9729
+ if (EFS?.readAsStringAsync !== void 0) {
9728
9730
  logger.debug("Using expo-file-system to read local file");
9729
9731
  const bufferSize = 1024 * 1024;
9732
+ const size = (await EFS.getInfoAsync(`file://${source.path}`)).size;
9730
9733
  let pos = 0;
9731
9734
  let eof = false;
9732
9735
  const stream = new ReadableStream({
@@ -9734,8 +9737,9 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9734
9737
  if (eof) {
9735
9738
  return;
9736
9739
  }
9740
+ const chunkSize = Math.min(bufferSize, size - pos);
9737
9741
  const chunkAsB64 = await EFS.readAsStringAsync(`file://${source.path}`, {
9738
- length: bufferSize,
9742
+ length: chunkSize,
9739
9743
  position: pos,
9740
9744
  encoding: "base64"
9741
9745
  });
@@ -9751,11 +9755,11 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
9751
9755
  });
9752
9756
  return {
9753
9757
  stream,
9754
- size: (await EFS.getInfoAsync(`file://${source.path}`)).size,
9758
+ size,
9755
9759
  mimeType: source.mimeType || "image/*"
9756
9760
  };
9757
9761
  }
9758
- 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.`);
9762
+ 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()`);
9759
9763
  };
9760
9764
  } else {
9761
9765
  let iteratorToStream = function(iterator) {
@@ -10239,6 +10243,13 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
10239
10243
  }
10240
10244
  } else if (init?.body instanceof ReadableStream) {
10241
10245
  streamBody = init.body;
10246
+ } else if (typeof init?.body === "string") {
10247
+ streamBody = new ReadableStream({
10248
+ start: (controller) => {
10249
+ controller.enqueue(Buffer.from(init?.body, "utf8"));
10250
+ controller.close();
10251
+ }
10252
+ });
10242
10253
  }
10243
10254
  if (streamBody) {
10244
10255
  if (TcpSockets?.TLSSocket !== void 0) {