@mentra/engine 3.2.0-dev.225 → 3.2.0-dev.227

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.
Files changed (33) hide show
  1. package/build/generated/releaseMetadata.js +5 -5
  2. package/build/generated/releaseMetadata.js.map +1 -1
  3. package/build/services/AcsMeetingService.d.ts +3 -1
  4. package/build/services/AcsMeetingService.d.ts.map +1 -1
  5. package/build/services/AcsMeetingService.js +9 -1
  6. package/build/services/AcsMeetingService.js.map +1 -1
  7. package/build/services/GlassesHotspotLease.d.ts +2 -0
  8. package/build/services/GlassesHotspotLease.d.ts.map +1 -0
  9. package/build/services/GlassesHotspotLease.js +13 -0
  10. package/build/services/GlassesHotspotLease.js.map +1 -0
  11. package/build/services/LocalMiniappRuntime.d.ts.map +1 -1
  12. package/build/services/LocalMiniappRuntime.js +14 -5
  13. package/build/services/LocalMiniappRuntime.js.map +1 -1
  14. package/build/services/ManagedWebRtcRelay.d.ts +87 -0
  15. package/build/services/ManagedWebRtcRelay.d.ts.map +1 -0
  16. package/build/services/ManagedWebRtcRelay.js +239 -0
  17. package/build/services/ManagedWebRtcRelay.js.map +1 -0
  18. package/build/services/PhoneStreamCoordinator.d.ts +5 -0
  19. package/build/services/PhoneStreamCoordinator.d.ts.map +1 -1
  20. package/build/services/PhoneStreamCoordinator.js +131 -68
  21. package/build/services/PhoneStreamCoordinator.js.map +1 -1
  22. package/build/services/SoftapCallTransport.d.ts +2 -1
  23. package/build/services/SoftapCallTransport.d.ts.map +1 -1
  24. package/build/services/SoftapCallTransport.js +6 -1
  25. package/build/services/SoftapCallTransport.js.map +1 -1
  26. package/package.json +8 -7
  27. package/src/generated/releaseMetadata.ts +5 -5
  28. package/src/services/AcsMeetingService.ts +10 -1
  29. package/src/services/GlassesHotspotLease.ts +11 -0
  30. package/src/services/LocalMiniappRuntime.ts +27 -11
  31. package/src/services/ManagedWebRtcRelay.ts +278 -0
  32. package/src/services/PhoneStreamCoordinator.ts +152 -70
  33. package/src/services/SoftapCallTransport.ts +8 -3
@@ -8,6 +8,7 @@
8
8
  * This runtime handles request dispatch, stream fan-out, and lifecycle
9
9
  * management (connect/disconnect/ping).
10
10
  */
11
+ import { acquireGlassesHotspot } from "./GlassesHotspotLease";
11
12
  import { AppState, Linking } from "react-native";
12
13
  import Share from "react-native-share";
13
14
  import * as Battery from "expo-battery";
@@ -46,7 +47,7 @@ import { miniappLauncher } from "./MiniappLauncher";
46
47
  import { ISLAND_SETTINGS_KEYS, } from "../runtime/config";
47
48
  import { getAnalytics, getMiniappConfiguration, getUiSeams, isFeatureEnabled } from "../runtime/bootstrap";
48
49
  import { invokeScanQrSeam } from "../runtime/scanQrSeam";
49
- import { normalizeStreamAudioConfig, normalizeStreamVideoConfig, resolveCaptureAudio } from "../runtime/streamConfig";
50
+ import { normalizeStreamAudioConfig, normalizeStreamVideoConfig, normalizeCaptureAudio, resolveCaptureAudio, } from "../runtime/streamConfig";
50
51
  import { toLanguageHint } from "@mentra/cloud-protocol/languages";
51
52
  import { buildMiniappManifestSnapshot } from "../utils/miniappDiagnostics";
52
53
  import ttsModelManager from "./TTSModelManager";
@@ -3083,13 +3084,18 @@ class LocalMiniappRuntime {
3083
3084
  return;
3084
3085
  }
3085
3086
  try {
3087
+ if (payload.ingest === "whip" && !(await permissions.check(PermissionFeatures.LOCAL_WIFI))) {
3088
+ if (!(await permissions.request(PermissionFeatures.LOCAL_WIFI))) {
3089
+ throw new Error("Nearby devices permission is required to join the glasses hotspot");
3090
+ }
3091
+ }
3086
3092
  const result = await streaming.startManaged(packageName, {
3087
3093
  restreamDestinations: payload.restreamDestinations,
3088
3094
  video: normalizeStreamVideoConfig(payload.video),
3089
3095
  audio: normalizeStreamAudioConfig(payload.audio),
3090
3096
  sound: payload.sound,
3091
3097
  ingest: payload.ingest,
3092
- captureAudio: resolveCaptureAudio(payload.captureAudio, resolveAcsAudioSource().source),
3098
+ captureAudio: normalizeCaptureAudio(payload.captureAudio),
3093
3099
  });
3094
3100
  this.sendResult(packageName, requestId, true, result);
3095
3101
  }
@@ -3371,6 +3377,7 @@ class LocalMiniappRuntime {
3371
3377
  softapTraceFailure("softap_join_refused", { packageName, reason: cleanupError });
3372
3378
  throw new Error(`Previous call cleanup failed: ${cleanupError}. Power-cycle the glasses hotspot and try again.`);
3373
3379
  }
3380
+ attempt.releaseHotspot = acquireGlassesHotspot();
3374
3381
  attempt.ownsResources = true;
3375
3382
  this.narrateSoftapPreflight(attempt, "Checking the Nearby devices permission…");
3376
3383
  const permissionStartedAt = Date.now();
@@ -3401,11 +3408,11 @@ class LocalMiniappRuntime {
3401
3408
  setHotspotState: async (enabled) => {
3402
3409
  const status = await BluetoothSdk.setHotspotState(enabled);
3403
3410
  if (status.state === "enabled") {
3404
- return { state: status.state, ssid: status.ssid, password: status.password };
3411
+ return { state: status.state, ssid: status.ssid, password: status.password, localIp: status.localIp };
3405
3412
  }
3406
3413
  return { state: status.state };
3407
3414
  },
3408
- joinScopedNetwork: (ssid, passphrase) => acsMeetingService.joinScopedNetwork(ssid, passphrase),
3415
+ joinScopedNetwork: (ssid, passphrase, gateway) => acsMeetingService.joinScopedNetwork(ssid, passphrase, gateway),
3409
3416
  leaveScopedNetwork: () => acsMeetingService.leaveScopedNetwork(),
3410
3417
  probeGateway: async () => {
3411
3418
  const verdict = await acsMeetingService.probeScopedGateway();
@@ -3732,6 +3739,8 @@ class LocalMiniappRuntime {
3732
3739
  failures: failures.join("; "),
3733
3740
  endRefused: Boolean(endFailure),
3734
3741
  });
3742
+ attempt.releaseHotspot?.();
3743
+ attempt.releaseHotspot = undefined;
3735
3744
  if (endFailure)
3736
3745
  throw endFailure;
3737
3746
  }
@@ -3852,7 +3861,7 @@ class LocalMiniappRuntime {
3852
3861
  }
3853
3862
  async handleMeetingUpdateVideoSource(packageName, payload, requestId) {
3854
3863
  const videoSource = payload.videoSource;
3855
- const whepUrl = videoSource?.type === "whep" ? videoSource.url ?? "" : "";
3864
+ const whepUrl = videoSource?.type === "whep" ? (videoSource.url ?? "") : "";
3856
3865
  if (!whepUrl) {
3857
3866
  this.sendResult(packageName, requestId, false, undefined, {
3858
3867
  code: MiniappErrorCode.INVALID_ARGUMENT,