@3dsource/angular-unreal-module 0.0.165 → 0.0.167
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/LICENSE
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
Copyright (c) 2025 3dsource
|
|
2
|
-
All Rights Reserved.
|
|
3
|
-
|
|
4
|
-
This software and associated documentation files (the “Software”) are proprietary
|
|
5
|
-
and confidential. Unauthorized copying, modification, distribution, or any other
|
|
6
|
-
use of the Software, in whole or in part, without the prior written consent of
|
|
7
|
-
the copyright holder is strictly prohibited.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
10
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
12
|
-
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
13
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
14
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
Copyright (c) 2025 3dsource
|
|
2
|
+
All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This software and associated documentation files (the “Software”) are proprietary
|
|
5
|
+
and confidential. Unauthorized copying, modification, distribution, or any other
|
|
6
|
+
use of the Software, in whole or in part, without the prior written consent of
|
|
7
|
+
the copyright holder is strictly prohibited.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
10
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
11
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
|
12
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
13
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
14
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,224 +1,228 @@
|
|
|
1
|
-
# @3dsource/angular-unreal-module
|
|
2
|
-
|
|
3
|
-
Standalone Angular integration for Unreal Engine Pixel Streaming. The package
|
|
4
|
-
provides the scene component, WebRTC and signalling lifecycle, NgRx state,
|
|
5
|
-
command/callback APIs, reconnection, file transfer and telemetry.
|
|
6
|
-
|
|
7
|
-
## Requirements
|
|
8
|
-
|
|
9
|
-
- Angular, Angular CDK and Angular Forms `>=19.0.0 <23.0.0`
|
|
10
|
-
- NgRx Store and Effects `>=19.0.0 <23.0.0`
|
|
11
|
-
- RxJS `>=7.8.0 <8.0.0`
|
|
12
|
-
- `@3dsource/
|
|
13
|
-
- `@3dsource/
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} from '@
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
| `
|
|
73
|
-
| `
|
|
74
|
-
| `
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
>
|
|
124
|
-
>
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
- `
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
<script
|
|
178
|
-
src="https://cdn.jsdelivr.net/npm/@3dsource/angular-unreal-module/js/
|
|
179
|
-
async
|
|
180
|
-
></script>
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
pnpm unreal:
|
|
202
|
-
pnpm unreal:
|
|
203
|
-
pnpm unreal:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
1
|
+
# @3dsource/angular-unreal-module
|
|
2
|
+
|
|
3
|
+
Standalone Angular integration for Unreal Engine Pixel Streaming. The package
|
|
4
|
+
provides the scene component, WebRTC and signalling lifecycle, NgRx state,
|
|
5
|
+
command/callback APIs, reconnection, file transfer and telemetry.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- Angular, Angular CDK and Angular Forms `>=19.0.0 <23.0.0`
|
|
10
|
+
- NgRx Store and Effects `>=19.0.0 <23.0.0`
|
|
11
|
+
- RxJS `>=7.8.0 <8.0.0`
|
|
12
|
+
- `@3dsource/types-unreal >=0.0.7`
|
|
13
|
+
- `@3dsource/utils >=1.0.21`
|
|
14
|
+
- `provideHttpClient()` in the host application
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```shell
|
|
19
|
+
pnpm add @3dsource/angular-unreal-module @3dsource/types-unreal @3dsource/utils
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
The package is standalone and does not expose an NgModule.
|
|
23
|
+
|
|
24
|
+
### Styling
|
|
25
|
+
|
|
26
|
+
The package ships its own styles and does not require any UI library. Its
|
|
27
|
+
components read `--src-*` design tokens where available, but every token has a
|
|
28
|
+
built-in fallback, so `@3dsource/source-ui-native` is entirely optional: install
|
|
29
|
+
it in the host application only if you want the components to follow that theme.
|
|
30
|
+
|
|
31
|
+
## Setup
|
|
32
|
+
|
|
33
|
+
### 1. Register state and configuration once
|
|
34
|
+
|
|
35
|
+
Add the Unreal feature state, HTTP client and configuration at the application
|
|
36
|
+
root. `UNREAL_CONFIG` is required, although all its fields are optional.
|
|
37
|
+
|
|
38
|
+
<!-- prettier-ignore -->
|
|
39
|
+
```typescript
|
|
40
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
41
|
+
import type { ApplicationConfig } from '@angular/core';
|
|
42
|
+
import { provideStore } from '@ngrx/store';
|
|
43
|
+
import {
|
|
44
|
+
provideUnrealState,
|
|
45
|
+
UNREAL_CONFIG,
|
|
46
|
+
type UnrealInitialConfig,
|
|
47
|
+
} from '@3dsource/angular-unreal-module';
|
|
48
|
+
|
|
49
|
+
const unrealConfig = {
|
|
50
|
+
regionsPingUrl: 'https://datacenter.3dsource.com/regions/',
|
|
51
|
+
dataChannelConnectionTimeout: 8000,
|
|
52
|
+
fpsMonitor: false,
|
|
53
|
+
autoHighResolution: false,
|
|
54
|
+
} satisfies UnrealInitialConfig;
|
|
55
|
+
|
|
56
|
+
export const appConfig: ApplicationConfig = {
|
|
57
|
+
providers: [
|
|
58
|
+
provideHttpClient(),
|
|
59
|
+
provideStore(),
|
|
60
|
+
provideUnrealState(),
|
|
61
|
+
{ provide: UNREAL_CONFIG, useValue: unrealConfig },
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Omit `provideStore()` when the root NgRx store is already configured.
|
|
67
|
+
|
|
68
|
+
Available configuration fields:
|
|
69
|
+
|
|
70
|
+
| Field | Purpose |
|
|
71
|
+
| ------------------------------ | ---------------------------------------------- |
|
|
72
|
+
| `regionsPingUrl` | Region latency endpoint |
|
|
73
|
+
| `dataChannelConnectionTimeout` | DataChannel connection timeout in ms |
|
|
74
|
+
| `customErrorsEndpoint` | Custom error reporting endpoint |
|
|
75
|
+
| `commandTelemetryReceiver` | Command telemetry endpoint |
|
|
76
|
+
| `streamTelemetryV2Url` | Stream lifecycle telemetry endpoint |
|
|
77
|
+
| `screenLockerContainerId` | Container used by the screen-locker overlay |
|
|
78
|
+
| `fpsMonitor` | Enables FPS monitoring |
|
|
79
|
+
| `autoHighResolution` | Raises resolution after the scene becomes idle |
|
|
80
|
+
| `playwright` | Enables the test-specific service behaviour |
|
|
81
|
+
|
|
82
|
+
Use `{ provide: UNREAL_CONFIG, useValue: {} }` for the minimal configuration.
|
|
83
|
+
|
|
84
|
+
### 2. Boot the engine on a lazy route
|
|
85
|
+
|
|
86
|
+
Lazy-load the route file from the application router:
|
|
87
|
+
|
|
88
|
+
<!-- prettier-ignore -->
|
|
89
|
+
```typescript
|
|
90
|
+
import type { Routes } from '@angular/router';
|
|
91
|
+
|
|
92
|
+
export const APP_ROUTES: Routes = [
|
|
93
|
+
{
|
|
94
|
+
path: 'stream',
|
|
95
|
+
loadChildren: () =>
|
|
96
|
+
import('./stream/stream.routes').then((module) => module.STREAM_ROUTES),
|
|
97
|
+
},
|
|
98
|
+
];
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Register `provideUnrealModule()` inside that lazy route file:
|
|
102
|
+
|
|
103
|
+
<!-- prettier-ignore -->
|
|
104
|
+
```typescript
|
|
105
|
+
import type { Routes } from '@angular/router';
|
|
106
|
+
import { provideUnrealModule } from '@3dsource/angular-unreal-module';
|
|
107
|
+
import { StreamComponent } from './stream.component';
|
|
108
|
+
|
|
109
|
+
export const STREAM_ROUTES: Routes = [
|
|
110
|
+
{
|
|
111
|
+
path: '',
|
|
112
|
+
component: StreamComponent,
|
|
113
|
+
providers: [provideUnrealModule()],
|
|
114
|
+
},
|
|
115
|
+
];
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Keep `provideUnrealState()` and `UNREAL_CONFIG` at the application root.
|
|
119
|
+
The `loadChildren()` boundary keeps the streaming engine out of the initial
|
|
120
|
+
bundle. Route-scoping `provideUnrealModule()` tears down its effects when the
|
|
121
|
+
route is left.
|
|
122
|
+
|
|
123
|
+
> `UNREAL_CONFIG` on a route's `providers` does **not** work: the engine
|
|
124
|
+
> services are `providedIn: 'root'`, so they are created by the root injector
|
|
125
|
+
> and read the token from there. A route-level value is invisible to them and
|
|
126
|
+
> `inject(UNREAL_CONFIG, { optional: true })` resolves to `null` — e.g. region
|
|
127
|
+
> pinging is skipped entirely (empty `regionsPingUrl`), the orchestration
|
|
128
|
+
> `requestStream` goes out without a region and the post-connection re-ping
|
|
129
|
+
> never runs. Importing only the token at the root does not pull the module into
|
|
130
|
+
> the initial bundle (the package is `sideEffects: false`).
|
|
131
|
+
|
|
132
|
+
### 3. Render the scene
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import { ChangeDetectionStrategy, Component } from '@angular/core';
|
|
136
|
+
import { UnrealSceneComponent } from '@3dsource/angular-unreal-module';
|
|
137
|
+
|
|
138
|
+
@Component({
|
|
139
|
+
selector: 'app-stream',
|
|
140
|
+
imports: [UnrealSceneComponent],
|
|
141
|
+
template: `<app-unreal-scene />`,
|
|
142
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
143
|
+
})
|
|
144
|
+
export class StreamComponent {}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
`UnrealSceneComponent` also accepts `isStudio`,
|
|
148
|
+
`useContainerAsSizeProvider` and `resolutionSize` inputs, and emits
|
|
149
|
+
`changeMouseOverScene`.
|
|
150
|
+
|
|
151
|
+
## Main API
|
|
152
|
+
|
|
153
|
+
- `provideUnrealState()` — registers the `unrealFeature` NgRx state.
|
|
154
|
+
- `provideUnrealModule()` — registers effects and boots streaming services.
|
|
155
|
+
- `UnrealSceneComponent` — renders and manages the Pixel Streaming scene.
|
|
156
|
+
- `UnrealCommunicatorService` — sends commands and UI interactions.
|
|
157
|
+
- `UnrealCallbackService` — observes Unreal callbacks and command responses.
|
|
158
|
+
- `unrealFeature`, exported selectors and actions — expose connection and scene
|
|
159
|
+
lifecycle state.
|
|
160
|
+
|
|
161
|
+
Command packet types are provided by `@3dsource/types-unreal`.
|
|
162
|
+
|
|
163
|
+
Run `pnpm demo:start` from the repository root to see the scene component in
|
|
164
|
+
the demo application.
|
|
165
|
+
|
|
166
|
+
## Optional prefetch scripts
|
|
167
|
+
|
|
168
|
+
The package publishes two dependency-free scripts for use in the document
|
|
169
|
+
`<head>` before Angular starts:
|
|
170
|
+
|
|
171
|
+
- `region-ping-prefetch.js` measures regions early and caches the closest one.
|
|
172
|
+
- `stream-prefetch.js` opens and parks an eligible WebRTC connection so Angular
|
|
173
|
+
can adopt it after bootstrap.
|
|
174
|
+
|
|
175
|
+
<!-- prettier-ignore -->
|
|
176
|
+
```html
|
|
177
|
+
<script
|
|
178
|
+
src="https://cdn.jsdelivr.net/npm/@3dsource/angular-unreal-module/js/region-ping-prefetch.js"
|
|
179
|
+
async
|
|
180
|
+
></script>
|
|
181
|
+
<script
|
|
182
|
+
src="https://cdn.jsdelivr.net/npm/@3dsource/angular-unreal-module/js/stream-prefetch.js"
|
|
183
|
+
async
|
|
184
|
+
></script>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
`stream-prefetch.js` runs by default only on
|
|
188
|
+
`metabox-configurator/{modular|basic}/...` routes. It reads the same-origin
|
|
189
|
+
`assets/config.json`; override that path with `data-config-url` when needed.
|
|
190
|
+
It also forwards the orchestration-issued `streamRequestId` from the polling
|
|
191
|
+
response to Cirrus on the WebSocket URL (the session `connectionId`) and parks it
|
|
192
|
+
for the Angular side to adopt.
|
|
193
|
+
Pin an exact package version in production when deterministic CDN assets are
|
|
194
|
+
required.
|
|
195
|
+
|
|
196
|
+
## Repository development
|
|
197
|
+
|
|
198
|
+
Run commands from the repository root:
|
|
199
|
+
|
|
200
|
+
```shell
|
|
201
|
+
pnpm unreal:build
|
|
202
|
+
pnpm unreal:build:watch
|
|
203
|
+
pnpm unreal:lint
|
|
204
|
+
pnpm unreal:test
|
|
205
|
+
pnpm unreal:test:watch
|
|
206
|
+
pnpm unreal:test:signalling
|
|
207
|
+
pnpm unreal:test:signalling:leaks
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
`unreal:build` builds the local `types-unreal` and `utils` dependencies before
|
|
211
|
+
this package.
|
|
212
|
+
|
|
213
|
+
Release commands publish only this package:
|
|
214
|
+
|
|
215
|
+
```shell
|
|
216
|
+
pnpm unreal:release:patch
|
|
217
|
+
pnpm unreal:release:dev
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
After a successful publish, the release automatically purges the matching
|
|
221
|
+
jsDelivr tag. Retry a failed purge without rerunning the release:
|
|
222
|
+
|
|
223
|
+
```shell
|
|
224
|
+
pnpm unreal:purge-cdn -- latest
|
|
225
|
+
pnpm unreal:purge-cdn -- dev
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
Repository tooling requires Node.js 24.16.0 or newer and pnpm 11.18.0.
|