@3dsource/angular-unreal-module 0.0.146-dev.5 → 0.0.146-dev.7

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@3dsource/angular-unreal-module",
3
- "version": "0.0.146-dev.5",
3
+ "version": "0.0.146-dev.7",
4
4
  "description": "Unreal module for connect with unreal engine stream",
5
5
  "keywords": [
6
6
  "3dsource",
@@ -1108,6 +1108,14 @@ declare class StreamAdoptionService {
1108
1108
  * this in `takeUntil(abortEstablishingConnection)`, so a route change / teardown
1109
1109
  * cancels it. Emits exactly once. Cancelling runs no adoption — which is what
1110
1110
  * stops a fast route-switch from starting overlapping connections.
1111
+ *
1112
+ * Wrapped in `defer` so the `tryAdopt()` side effect (which dispatches
1113
+ * `streamAdopted`) runs at SUBSCRIPTION time, not when the observable is
1114
+ * built. The effect prepends `startWith(setEstablishingConnection(true))`,
1115
+ * which starts the telemetry session and subscribes its phase catalog; that
1116
+ * must happen BEFORE `streamAdopted` → `regionTelemetryOnAdopt$` replays
1117
+ * `regionResolved`, or the region phase fires into a session that doesn't
1118
+ * exist yet and is lost. `defer` guarantees that ordering.
1111
1119
  */
1112
1120
  awaitAndAdopt$(): Observable<boolean>;
1113
1121
  /**
@@ -1206,6 +1214,17 @@ declare class StreamStatusTelemetryService2 {
1206
1214
  private readonly disconnectReason$;
1207
1215
  private readonly errorMessage$;
1208
1216
  private readonly viewPortReady$;
1217
+ /**
1218
+ * Synchronous adoption flag. The `streamAdopted` reducer sets it BEFORE any
1219
+ * action subscriber runs, so the connection-phase closers (which fire inside
1220
+ * the same dispatch, e.g. `ssinfo-received` off the `ssData` state change)
1221
+ * can read it and defer to the prefetch-timed attribution emitted by
1222
+ * {@link emitAdoptedConnection} instead of recording the live wall-clock.
1223
+ */
1224
+ private readonly adopted$;
1225
+ /** Streamer identity for the adopted signaling phase params. */
1226
+ private readonly ssData$;
1227
+ private readonly awsInstance$;
1209
1228
  private session;
1210
1229
  /**
1211
1230
  * Whether a session has already started during the current page lifetime.
@@ -1269,6 +1288,35 @@ declare class StreamStatusTelemetryService2 {
1269
1288
  * are derived from neighbor phases.
1270
1289
  */
1271
1290
  private emitPhaseEnded;
1291
+ /**
1292
+ * Emit the region / signaling / webrtc phases for an ADOPTED connection.
1293
+ *
1294
+ * The prefetch script established the connection in parallel with page load,
1295
+ * so its raw timeline (prefetch_start … ready) mostly predates this session —
1296
+ * showing it verbatim would look identical to a non-prefetched connect. What
1297
+ * matters is measured from the moment Angular reached the connect call
1298
+ * (session start, == `lastMilestonePerf` here): the REAL wait until adoption,
1299
+ * and how much the prefetch SAVED by finishing the handshake during page load.
1300
+ *
1301
+ * So the three phases fill exactly the `[session start → adopted]` window
1302
+ * (split across signaling / webrtc by the prefetch's own sub-step ratio; the
1303
+ * region was served from cache → ~0), and the savings figures ride in params:
1304
+ * - `prefetchConnectMs` — full handshake the prefetch measured (the cost a
1305
+ * cold, non-prefetched connect would pay here).
1306
+ * - `prefetchSavedMs` — how much of it completed before Angular was ready.
1307
+ * - `adoptionWaitMs` — the actual wait Angular experienced (= window).
1308
+ * - `adoptionOverheadMs` — gap between prefetch-ready and adoption.
1309
+ */
1310
+ private emitAdoptedConnection;
1311
+ /** Emit one adopted phase with an explicit (prefetch-derived) duration and
1312
+ * advance `lastMilestonePerf` synthetically so the next phase chains right. */
1313
+ private emitAdoptedPhase;
1314
+ /** Streamer identity params for the adopted signaling phase — mirrors the
1315
+ * `ssinfo-received` closer's shape (client / instanceName / …ssData). */
1316
+ private adoptedSignalingParams;
1317
+ /** Read the region-ping cache the prefetch reused (localStorage), so the
1318
+ * adopted region phase can still report the winning region + samples. */
1319
+ private readRegionCache;
1272
1320
  private handleWindow;
1273
1321
  private evaluateAnomalies;
1274
1322
  private updateMaxFpsTarget;
@@ -2581,9 +2629,29 @@ declare const initSignalling: node_modules__ngrx_store_types_ngrx_store.ActionCr
2581
2629
  declare const streamAdopted: node_modules__ngrx_store_types_ngrx_store.ActionCreator<string, (props: {
2582
2630
  machineId: string | null;
2583
2631
  ssData: SignalingData | null;
2632
+ /**
2633
+ * `performance.now()` marks the prefetch script recorded while it
2634
+ * established the connection (`prefetch_start` / `ws_open` / `dc_open` /
2635
+ * `ready`), on the page navigation timeline. The telemetry service uses
2636
+ * them to attribute the signaling / webrtc phase durations to the time the
2637
+ * prefetch actually spent — instead of dumping the whole pre-adoption wait
2638
+ * onto whichever phase closer happens to fire first. `null` when adopting a
2639
+ * stream that carried no timings.
2640
+ */
2641
+ timings: Record<string, number> | null;
2584
2642
  }) => {
2585
2643
  machineId: string | null;
2586
2644
  ssData: SignalingData | null;
2645
+ /**
2646
+ * `performance.now()` marks the prefetch script recorded while it
2647
+ * established the connection (`prefetch_start` / `ws_open` / `dc_open` /
2648
+ * `ready`), on the page navigation timeline. The telemetry service uses
2649
+ * them to attribute the signaling / webrtc phase durations to the time the
2650
+ * prefetch actually spent — instead of dumping the whole pre-adoption wait
2651
+ * onto whichever phase closer happens to fire first. `null` when adopting a
2652
+ * stream that carried no timings.
2653
+ */
2654
+ timings: Record<string, number> | null;
2587
2655
  } & node_modules__ngrx_store_types_ngrx_store.Action<string>>;
2588
2656
  declare const startStream: node_modules__ngrx_store_types_ngrx_store.ActionCreator<string, (props: {
2589
2657
  config: Partial<StreamConfig>;
@@ -2802,7 +2870,6 @@ declare class UnrealEffects {
2802
2870
  connectToSignaling$: node_modules_rxjs_dist_types.Observable<{
2803
2871
  value: boolean;
2804
2872
  } & node_modules__ngrx_store_types_ngrx_store.Action<string>> & node_modules__ngrx_effects_types_ngrx_effects.CreateEffectMetadata;
2805
- regionTelemetryOnAdopt$: node_modules_rxjs_dist_types.Observable<node_modules__ngrx_store_types_ngrx_store.Action<string>> & node_modules__ngrx_effects_types_ngrx_effects.CreateEffectMetadata;
2806
2873
  private canPeerReconnect;
2807
2874
  /**
2808
2875
  * Either schedules the next peer-reconnect attempt or gives up with the
@@ -2819,6 +2886,7 @@ declare const unrealFeature: {
2819
2886
  name: "unrealFeature";
2820
2887
  reducer: node_modules__ngrx_store_types_ngrx_store.ActionReducer<_3dsource_angular_unreal_module.UnrealState, node_modules__ngrx_store_types_ngrx_store.Action<string>>;
2821
2888
  selectUnrealFeatureState: node_modules__ngrx_store_types_ngrx_store.MemoizedSelector<Record<string, any>, _3dsource_angular_unreal_module.UnrealState, (featureState: _3dsource_angular_unreal_module.UnrealState) => _3dsource_angular_unreal_module.UnrealState>;
2889
+ selectAdopted: node_modules__ngrx_store_types_ngrx_store.MemoizedSelector<Record<string, any>, boolean, (featureState: _3dsource_angular_unreal_module.UnrealState) => boolean>;
2822
2890
  selectFreezeFrame: node_modules__ngrx_store_types_ngrx_store.MemoizedSelector<Record<string, any>, _3dsource_angular_unreal_module.FreezeFrameMessage, (featureState: _3dsource_angular_unreal_module.UnrealState) => _3dsource_angular_unreal_module.FreezeFrameMessage>;
2823
2891
  selectIsVideoPlaying: node_modules__ngrx_store_types_ngrx_store.MemoizedSelector<Record<string, any>, boolean, (featureState: _3dsource_angular_unreal_module.UnrealState) => boolean>;
2824
2892
  selectStatusMessage: node_modules__ngrx_store_types_ngrx_store.MemoizedSelector<Record<string, any>, string | null, (featureState: _3dsource_angular_unreal_module.UnrealState) => string | null>;
@@ -2875,6 +2943,13 @@ interface UnrealState {
2875
2943
  isAfkTimerVisible: boolean;
2876
2944
  afkCountdown: number;
2877
2945
  cirrusConnected: boolean;
2946
+ /**
2947
+ * True once a prefetched connection has been adopted (`streamAdopted`).
2948
+ * Read synchronously by the telemetry service so the connection-phase
2949
+ * closers know to defer to the prefetch-timed attribution instead of the
2950
+ * live-event one. Reset on every fresh attempt / disconnect.
2951
+ */
2952
+ adopted: boolean;
2878
2953
  viewportReady: boolean;
2879
2954
  freezeFrameFromVideo: FreezeFrameMessage;
2880
2955
  freezeFrame: FreezeFrameMessage;