@3dsource/angular-unreal-module 0.0.146-dev.1 → 0.0.146-dev.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.
@@ -5616,9 +5616,16 @@ class StreamStatusTelemetryService2 {
5616
5616
  // samples (one per probe) from `RegionsPingService`; the
5617
5617
  // catalog flattens them to a comma-separated string since
5618
5618
  // `toPhaseParams` only accepts primitives.
5619
+ //
5620
+ // Adopted connections skip `connectToSignaling` → `getRegion`, so
5621
+ // `regionResolved` never fires. We synthesise it from `streamAdopted`
5622
+ // using the cached ping result the prefetch reused, so the region
5623
+ // phase still appears (with its ping samples). Because this fires at
5624
+ // adoption time it also re-anchors `lastMilestonePerf`, which keeps the
5625
+ // following signaling / webrtc phases at ~0 for adopted sessions.
5619
5626
  {
5620
5627
  id: 'region-resolved',
5621
- event: this.actions$.pipe(ofType(regionResolved), take(1), map(({ region, pingsMs }) => ({
5628
+ event: merge(this.actions$.pipe(ofType(regionResolved)), this.actions$.pipe(ofType(streamAdopted), map(() => this.cachedRegionResult()))).pipe(take(1), map(({ region, pingsMs }) => ({
5622
5629
  region,
5623
5630
  pingsMs: pingsMs.length ? `${pingsMs.join(', ')} ms` : null,
5624
5631
  }))),
@@ -5779,6 +5786,29 @@ class StreamStatusTelemetryService2 {
5779
5786
  return v4();
5780
5787
  }
5781
5788
  }
5789
+ /**
5790
+ * Region winner + ping samples cached in `localStorage` by
5791
+ * `region-ping-prefetch.js` / `RegionsPingService` (`REGION_PING_CACHE_KEY`).
5792
+ * Used to fill the region phase for ADOPTED connections, which never run
5793
+ * `getRegion()` and so never dispatch `regionResolved`. Empty when there is
5794
+ * no usable cache.
5795
+ */
5796
+ cachedRegionResult() {
5797
+ try {
5798
+ const raw = localStorage.getItem(REGION_PING_CACHE_KEY);
5799
+ const parsed = raw ? JSON.parse(raw) : null;
5800
+ if (parsed && typeof parsed.region_code === 'string') {
5801
+ return {
5802
+ region: parsed.region_code,
5803
+ pingsMs: Array.isArray(parsed.result) ? parsed.result : [],
5804
+ };
5805
+ }
5806
+ }
5807
+ catch {
5808
+ /* ignore — best-effort */
5809
+ }
5810
+ return { region: '', pingsMs: [] };
5811
+ }
5782
5812
  init() {
5783
5813
  // Start a new session when a real connection attempt BEGINS, not on
5784
5814
  // every `initSignalling` dispatch. `initSignalling` is fired multiple