@interlucent/pixel-stream 0.0.78
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/README.md +5 -0
- package/dist/pixel-stream.d.ts +553 -0
- package/dist/pixel-stream.esm.js +7892 -0
- package/dist/pixel-stream.iife.js +7900 -0
- package/dist/pixel-stream.iife.min.js +2 -0
- package/dist/pixel-stream.umd.js +7906 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,553 @@
|
|
|
1
|
+
import type { LogLevel } from '@interlucent/logging';
|
|
2
|
+
|
|
3
|
+
declare interface AdmissionConfig {
|
|
4
|
+
/** Required token for session admission */
|
|
5
|
+
admissionToken: string;
|
|
6
|
+
/** Optional application identifier (overrides/supplements admission token) */
|
|
7
|
+
appId?: string;
|
|
8
|
+
/** Optional application version refinement */
|
|
9
|
+
appVersion?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
declare interface PerformanceMetrics {
|
|
13
|
+
sessionStarted: number | null;
|
|
14
|
+
tokenExchangeStart: number | null;
|
|
15
|
+
tokenExchangeComplete: number | null;
|
|
16
|
+
peerConnectionCreated: number | null;
|
|
17
|
+
sessionWsConnectStart: number | null;
|
|
18
|
+
sessionWsConnectComplete: number | null;
|
|
19
|
+
sessionReady: number | null;
|
|
20
|
+
jobRequested: number | null;
|
|
21
|
+
subscribeStart: number | null;
|
|
22
|
+
offerReceived: number | null;
|
|
23
|
+
answerSent: number | null;
|
|
24
|
+
iceConnected: number | null;
|
|
25
|
+
firstTrack: number | null;
|
|
26
|
+
firstFrame: number | null;
|
|
27
|
+
connectionComplete: number | null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export declare class PixelStream extends HTMLElement {
|
|
31
|
+
/** Package version, injected at build time. */
|
|
32
|
+
static readonly VERSION: string;
|
|
33
|
+
/** Instance accessor for the package version. */
|
|
34
|
+
get version(): string;
|
|
35
|
+
/** Current configuration snapshot. */
|
|
36
|
+
get config(): PixelStreamConfig;
|
|
37
|
+
readonly performanceMetrics: PerformanceMetrics;
|
|
38
|
+
static get observedAttributes(): string[];
|
|
39
|
+
get nativeTouch(): boolean;
|
|
40
|
+
set nativeTouch(value: boolean);
|
|
41
|
+
get pointerLock(): boolean;
|
|
42
|
+
set pointerLock(value: boolean);
|
|
43
|
+
get pointerLockRelease(): boolean;
|
|
44
|
+
set pointerLockRelease(value: boolean);
|
|
45
|
+
get suppressBrowserKeys(): boolean;
|
|
46
|
+
set suppressBrowserKeys(value: boolean);
|
|
47
|
+
/**
|
|
48
|
+
* Debug mode - shows visual indicators for session connectivity.
|
|
49
|
+
* When enabled, displays a colored border/glow:
|
|
50
|
+
* - Gray: idle/no session
|
|
51
|
+
* - Yellow: connecting/authenticating/reconnecting
|
|
52
|
+
* - Green: connected
|
|
53
|
+
* - Red: error
|
|
54
|
+
*/
|
|
55
|
+
get debug(): boolean;
|
|
56
|
+
set debug(value: boolean);
|
|
57
|
+
get logLevel(): LogLevel;
|
|
58
|
+
set logLevel(value: LogLevel);
|
|
59
|
+
/**
|
|
60
|
+
* ICE candidate batching delay in milliseconds.
|
|
61
|
+
* - 0ms for localhost/LAN (no batching overhead)
|
|
62
|
+
* - 10-20ms for regional networks
|
|
63
|
+
* - 50-100ms for high-latency or mobile networks
|
|
64
|
+
*/
|
|
65
|
+
get iceBatchDelay(): number;
|
|
66
|
+
set iceBatchDelay(value: number);
|
|
67
|
+
/**
|
|
68
|
+
* Required token for session admission.
|
|
69
|
+
* Setting this triggers an 'admission-token-change' event.
|
|
70
|
+
*/
|
|
71
|
+
get admissionToken(): string | null;
|
|
72
|
+
set admissionToken(value: string | null);
|
|
73
|
+
/**
|
|
74
|
+
* Optional application identifier (overrides/supplements admission token)
|
|
75
|
+
*/
|
|
76
|
+
get appId(): string | null;
|
|
77
|
+
set appId(value: string | null);
|
|
78
|
+
/**
|
|
79
|
+
* Optional application version refinement
|
|
80
|
+
*/
|
|
81
|
+
get appVersion(): string | null;
|
|
82
|
+
set appVersion(value: string | null);
|
|
83
|
+
/**
|
|
84
|
+
* Disable automatic session connection when admission token is set.
|
|
85
|
+
* By default, the component auto-connects. Set this to opt out and
|
|
86
|
+
* manage session lifecycle manually via `startSession()`.
|
|
87
|
+
*/
|
|
88
|
+
get noAutoConnect(): boolean;
|
|
89
|
+
set noAutoConnect(value: boolean);
|
|
90
|
+
/**
|
|
91
|
+
* Mute audio output
|
|
92
|
+
*/
|
|
93
|
+
get mute(): boolean;
|
|
94
|
+
set mute(value: boolean);
|
|
95
|
+
/**
|
|
96
|
+
* Audio output volume (0.0 silent – 1.0 full).
|
|
97
|
+
* Applies to both the video and dedicated audio elements.
|
|
98
|
+
*/
|
|
99
|
+
get volume(): number;
|
|
100
|
+
set volume(value: number);
|
|
101
|
+
/**
|
|
102
|
+
* Milliseconds to wait for a peer streamer before giving up.
|
|
103
|
+
* If set and no streamer connects within this time, 'rendezvous-timeout' event is fired.
|
|
104
|
+
*/
|
|
105
|
+
get rendezvousPreference(): number | null;
|
|
106
|
+
set rendezvousPreference(value: number | null);
|
|
107
|
+
/**
|
|
108
|
+
* Milliseconds to remain in session after all other agents leave.
|
|
109
|
+
* When the last peer leaves, a 'linger-started' event is fired and the timer begins.
|
|
110
|
+
* If no peer reconnects, 'linger-timeout' event is fired.
|
|
111
|
+
*/
|
|
112
|
+
get lingerPreference(): number | null;
|
|
113
|
+
set lingerPreference(value: number | null);
|
|
114
|
+
/**
|
|
115
|
+
* Milliseconds grace period before this client appears as left to other agents.
|
|
116
|
+
* This allows for brief disconnections without triggering peer 'left' events.
|
|
117
|
+
*/
|
|
118
|
+
get leftGracePeriod(): number | null;
|
|
119
|
+
set leftGracePeriod(value: number | null);
|
|
120
|
+
/**
|
|
121
|
+
* API endpoint for token exchange and WebSocket connections.
|
|
122
|
+
* Defaults to 'api.interlucent.ai'. Use 'api.dev.interlucent.ai' for dev stack.
|
|
123
|
+
*/
|
|
124
|
+
get apiEndpoint(): string;
|
|
125
|
+
set apiEndpoint(value: string);
|
|
126
|
+
/**
|
|
127
|
+
* Reconnection mode: 'none', 'recover', or 'always'.
|
|
128
|
+
* - none: No automatic reconnection (default)
|
|
129
|
+
* - recover: Reconnect to the same session using existing access token
|
|
130
|
+
* - always: Always attempt reconnection (for future use)
|
|
131
|
+
*/
|
|
132
|
+
get reconnectMode(): 'none' | 'recover' | 'always';
|
|
133
|
+
set reconnectMode(value: 'none' | 'recover' | 'always');
|
|
134
|
+
/**
|
|
135
|
+
* Maximum number of reconnection attempts.
|
|
136
|
+
* Use Infinity or -1 for unlimited attempts.
|
|
137
|
+
*/
|
|
138
|
+
get reconnectAttempts(): number;
|
|
139
|
+
set reconnectAttempts(value: number);
|
|
140
|
+
/**
|
|
141
|
+
* Reconnection strategy: 'periodic' or 'exponential-backoff'.
|
|
142
|
+
*/
|
|
143
|
+
get reconnectStrategy(): 'periodic' | 'exponential-backoff';
|
|
144
|
+
set reconnectStrategy(value: 'periodic' | 'exponential-backoff');
|
|
145
|
+
/**
|
|
146
|
+
* Reconnection interval in milliseconds (for periodic strategy).
|
|
147
|
+
*/
|
|
148
|
+
get reconnectInterval(): number;
|
|
149
|
+
set reconnectInterval(value: number);
|
|
150
|
+
/**
|
|
151
|
+
* Grace period in milliseconds before treating a disconnected WebRTC connection as failed.
|
|
152
|
+
* During this period, RTP stats are polled to check if media is still flowing.
|
|
153
|
+
* Default: 9000ms (9 seconds)
|
|
154
|
+
*/
|
|
155
|
+
get disconnectGraceMs(): number;
|
|
156
|
+
set disconnectGraceMs(value: number);
|
|
157
|
+
/**
|
|
158
|
+
* Resize mode - determines what messages are sent when viewport resizes.
|
|
159
|
+
* - 'none': No automatic resize messages sent
|
|
160
|
+
* - 'auto': Auto-detect best format based on UE version/response
|
|
161
|
+
* - 'pureweb': Pureweb plugin format (UIInteraction with action: '1', width, height)
|
|
162
|
+
* - 'pre-5.4': Legacy mode - sends UIInteraction with Console command (r.setres WxH)
|
|
163
|
+
* - '5.4+': Modern mode (default) - sends Command with Resolution.Width/Height
|
|
164
|
+
*/
|
|
165
|
+
get resizeMode(): 'none' | 'auto' | 'pureweb' | 'pre-5.4' | '5.4+';
|
|
166
|
+
set resizeMode(value: 'none' | 'auto' | 'pureweb' | 'pre-5.4' | '5.4+');
|
|
167
|
+
/**
|
|
168
|
+
* DPR cap - limits devicePixelRatio used when computing resize dimensions.
|
|
169
|
+
* - 1 (default): Send CSS pixels to the game (matches Epic's PixelStreamingInfrastructure).
|
|
170
|
+
* Games handle their own internal resolution scaling.
|
|
171
|
+
* - Infinity: Send physical device pixels (matches PureWeb SDK behavior).
|
|
172
|
+
* Can cause issues on Retina displays (2x/3x) when games can't handle the resolution.
|
|
173
|
+
* - 1.5, 2, etc.: Allow some Retina benefit with a cap.
|
|
174
|
+
*/
|
|
175
|
+
get dprCap(): number;
|
|
176
|
+
set dprCap(value: number);
|
|
177
|
+
/**
|
|
178
|
+
* Resolution clamp — caps device-pixel dimensions sent to the server.
|
|
179
|
+
* Accepts a named preset string (e.g. 'fhd', 'qhd') or a custom { maxWidth, maxHeight } object.
|
|
180
|
+
* Set to null to disable clamping.
|
|
181
|
+
*/
|
|
182
|
+
get resolutionClamp(): StreamResolutionClamp | null;
|
|
183
|
+
set resolutionClamp(value: StreamResolutionClamp | ResolutionClampName | null);
|
|
184
|
+
/**
|
|
185
|
+
* Check if the current stream is detected as an XR/stereo stream.
|
|
186
|
+
* Detection is based on:
|
|
187
|
+
* - Multiple video tracks with XR-like labels (left/right/stereo)
|
|
188
|
+
* - Side-by-side stereo aspect ratio (>3.5:1)
|
|
189
|
+
* - Exactly 2 video tracks (stereo pair)
|
|
190
|
+
*/
|
|
191
|
+
get isXRStream(): boolean;
|
|
192
|
+
/**
|
|
193
|
+
* Current session connection state.
|
|
194
|
+
* One of: 'idle', 'connecting', 'authenticating', 'connected', 'reconnecting', 'error'
|
|
195
|
+
*/
|
|
196
|
+
get sessionState(): string;
|
|
197
|
+
/**
|
|
198
|
+
* Current WebRTC media pipeline state.
|
|
199
|
+
* One of: 'idle', 'starting', 'streaming', 'interrupted', 'recovering', 'failed'
|
|
200
|
+
*/
|
|
201
|
+
get streamState(): string;
|
|
202
|
+
/**
|
|
203
|
+
* Derived meta-status combining session, job, and stream states into a
|
|
204
|
+
* single user-facing progression.
|
|
205
|
+
*/
|
|
206
|
+
get status(): PixelStreamStatus;
|
|
207
|
+
/**
|
|
208
|
+
* When status is 'failed', the reason for the failure (e.g.
|
|
209
|
+
* 'queue_wait_timeout', 'media_pipeline_failure'). Null otherwise.
|
|
210
|
+
*/
|
|
211
|
+
get failureReason(): string | null;
|
|
212
|
+
/**
|
|
213
|
+
* Timestamp (Date.now()) of the last user input sent to the streamer.
|
|
214
|
+
* Returns 0 if no input has been sent yet. Consumers can poll this to
|
|
215
|
+
* implement their own idle timeouts.
|
|
216
|
+
*/
|
|
217
|
+
get lastUserInteraction(): number;
|
|
218
|
+
/**
|
|
219
|
+
* Timestamp (Date.now()) of when the stream began.
|
|
220
|
+
* Returns 0 if not currently streaming.
|
|
221
|
+
*/
|
|
222
|
+
get streamStartedAt(): number;
|
|
223
|
+
/**
|
|
224
|
+
* Access token obtained from token exchange (read-only)
|
|
225
|
+
*/
|
|
226
|
+
get accessToken(): string | null;
|
|
227
|
+
/**
|
|
228
|
+
* Session ID obtained from token exchange (read-only)
|
|
229
|
+
*/
|
|
230
|
+
get sessionId(): string | null;
|
|
231
|
+
/**
|
|
232
|
+
* Agent ID obtained from token exchange (read-only)
|
|
233
|
+
*/
|
|
234
|
+
get agentId(): string | null;
|
|
235
|
+
/**
|
|
236
|
+
* ICE servers obtained from token exchange (read-only)
|
|
237
|
+
*/
|
|
238
|
+
get iceServers(): RTCIceServer[];
|
|
239
|
+
/**
|
|
240
|
+
* Get the current admission configuration
|
|
241
|
+
*/
|
|
242
|
+
getAdmissionConfig(): AdmissionConfig | null;
|
|
243
|
+
/**
|
|
244
|
+
* Get the current session preferences
|
|
245
|
+
*/
|
|
246
|
+
getSessionPreferences(): SessionPreferences;
|
|
247
|
+
/**
|
|
248
|
+
* Check if the player is currently admitted to a session
|
|
249
|
+
*/
|
|
250
|
+
get isAdmitted(): boolean;
|
|
251
|
+
constructor();
|
|
252
|
+
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
253
|
+
connectedCallback(): void;
|
|
254
|
+
disconnectedCallback(): void;
|
|
255
|
+
startXRSession(): Promise<void>;
|
|
256
|
+
endXRSession(): void;
|
|
257
|
+
static isXRSupported(): Promise<boolean>;
|
|
258
|
+
resetPerformanceMetrics(): void;
|
|
259
|
+
getPerformanceMetrics(): PerformanceMetrics;
|
|
260
|
+
collectAndDisplaySessionStats(): Promise<SessionStats | null>;
|
|
261
|
+
/**
|
|
262
|
+
* Handle InitialSettings message to extract UE version hints for resize mode selection.
|
|
263
|
+
* Called from webrtc.ts when InitialSettings is received.
|
|
264
|
+
*/
|
|
265
|
+
_handleInitialSettingsForResize(settings: any): void;
|
|
266
|
+
/**
|
|
267
|
+
* Detect if the current stream is an XR/stereo stream based on track heuristics.
|
|
268
|
+
* Updates _isXRStream and dispatches 'xr-stream-detected' event if detected.
|
|
269
|
+
*/
|
|
270
|
+
_detectXRStream(): void;
|
|
271
|
+
/** Send message to UE via WebRTC data channel */
|
|
272
|
+
sendToStreamer(type: string, data?: Array<number | string>): void;
|
|
273
|
+
/** Send raw binary data over the data channel */
|
|
274
|
+
sendRawBinary(buffer: ArrayBuffer | Uint8Array): void;
|
|
275
|
+
sendCommand(command: object | string): void;
|
|
276
|
+
sendUIInteraction(descriptor: object | string): void;
|
|
277
|
+
requestIFrame(): void;
|
|
278
|
+
requestKeyFrame(): void;
|
|
279
|
+
requestQualityControl(): void;
|
|
280
|
+
requestFps(fps: number): void;
|
|
281
|
+
requestBitrate(): void;
|
|
282
|
+
startStreaming(): void;
|
|
283
|
+
stopStreaming(): void;
|
|
284
|
+
sendTestEcho(message: string): void;
|
|
285
|
+
checkPermission(permission: 'microphone' | 'camera'): Promise<string>;
|
|
286
|
+
checkPermissions(permissions: Array<'microphone' | 'camera'>): Promise<Record<string, string>>;
|
|
287
|
+
watchPermission(permission: 'microphone' | 'camera'): Promise<void>;
|
|
288
|
+
requestMicrophone(): Promise<boolean>;
|
|
289
|
+
enableMicrophone(): Promise<void>;
|
|
290
|
+
disableMicrophone(): void;
|
|
291
|
+
setMicrophoneMuted(muted: boolean): void;
|
|
292
|
+
get isMicrophoneEnabled(): boolean;
|
|
293
|
+
get isMicrophoneMuted(): boolean;
|
|
294
|
+
getVideoTracks(): Array<{
|
|
295
|
+
trackId: string;
|
|
296
|
+
label: string;
|
|
297
|
+
isActive: boolean;
|
|
298
|
+
}>;
|
|
299
|
+
switchVideoTrack(trackId: string): void;
|
|
300
|
+
getActiveVideoTrack(): {
|
|
301
|
+
trackId: string;
|
|
302
|
+
label: string;
|
|
303
|
+
} | null;
|
|
304
|
+
/**
|
|
305
|
+
* Get the last received file from UE (if available)
|
|
306
|
+
* Returns null if no file has been received or file is incomplete
|
|
307
|
+
*/
|
|
308
|
+
getLastReceivedFile(): ReceivedFile | null;
|
|
309
|
+
/**
|
|
310
|
+
* Wait for the next file to be received from UE
|
|
311
|
+
* Returns a promise that resolves when a complete file is received
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* const file = await player.waitForFile();
|
|
315
|
+
* const url = URL.createObjectURL(file.blob);
|
|
316
|
+
* const a = document.createElement('a');
|
|
317
|
+
* a.href = url;
|
|
318
|
+
* a.download = `file.${file.extension}`;
|
|
319
|
+
* a.click();
|
|
320
|
+
*/
|
|
321
|
+
waitForFile(): Promise<ReceivedFile>;
|
|
322
|
+
/**
|
|
323
|
+
* Set the video source (for testing or manual stream setup)
|
|
324
|
+
*/
|
|
325
|
+
setVideoSource(srcObject: MediaStream): void;
|
|
326
|
+
/**
|
|
327
|
+
* Start a session by exchanging the admission token for an access token,
|
|
328
|
+
* then connecting the WebSocket for signalling.
|
|
329
|
+
*/
|
|
330
|
+
startSession(): Promise<void>;
|
|
331
|
+
/**
|
|
332
|
+
* Send a message through the session WebSocket.
|
|
333
|
+
*/
|
|
334
|
+
sendSessionMessage(message: object): void;
|
|
335
|
+
/**
|
|
336
|
+
* Request a marketplace job for this session.
|
|
337
|
+
* @deprecated Use {@link play} instead — it handles all states including autoplay.
|
|
338
|
+
*/
|
|
339
|
+
requestJob(): Promise<void>;
|
|
340
|
+
/**
|
|
341
|
+
* Start or resume streaming — the primary user-facing action.
|
|
342
|
+
*
|
|
343
|
+
* Handles all states:
|
|
344
|
+
* - Autoplay blocked → resumes video playback
|
|
345
|
+
* - Session connected, job unsubmitted → sends `request-job`
|
|
346
|
+
* - Session connecting → waits for connect hook
|
|
347
|
+
* - Session idle → starts session, connect hook sends `request-job`
|
|
348
|
+
* - Error/ended → clears error state and restarts
|
|
349
|
+
*
|
|
350
|
+
* Must be triggered by a user gesture for browser autoplay policy.
|
|
351
|
+
*/
|
|
352
|
+
play(): Promise<void>;
|
|
353
|
+
/**
|
|
354
|
+
* Cancel a pending job request.
|
|
355
|
+
*/
|
|
356
|
+
cancel(): void;
|
|
357
|
+
/**
|
|
358
|
+
* Request a session invite token.
|
|
359
|
+
*
|
|
360
|
+
* Sends a `request-invite` message to the session. The server responds with
|
|
361
|
+
* an `invite-token` event containing a short-lived JWT that can be passed as
|
|
362
|
+
* the `admission-token` to a second `<pixel-stream>` element, allowing it to
|
|
363
|
+
* join the same session as a `session-collaborator`.
|
|
364
|
+
*
|
|
365
|
+
* Only the session owner (browser-agent) may call this. Requires an active
|
|
366
|
+
* WebSocket connection — call after the `session-connected` event.
|
|
367
|
+
*/
|
|
368
|
+
requestInvite(): void;
|
|
369
|
+
/**
|
|
370
|
+
* Stop the session gracefully.
|
|
371
|
+
*/
|
|
372
|
+
stop(reason?: string): void;
|
|
373
|
+
/** @deprecated Use {@link play}. */
|
|
374
|
+
resumePlayback(): Promise<void>;
|
|
375
|
+
/** @deprecated Use {@link cancel}. */
|
|
376
|
+
cancelJob(): void;
|
|
377
|
+
/** @deprecated Use {@link stop}. */
|
|
378
|
+
leaveSession(reason?: string): void;
|
|
379
|
+
subscribeToStreamer(streamerId: string): void;
|
|
380
|
+
get availableStreamers(): string[];
|
|
381
|
+
/**
|
|
382
|
+
* Update the debug visual indicator based on current session state.
|
|
383
|
+
* Only applies when the 'debug' attribute is set.
|
|
384
|
+
*/
|
|
385
|
+
_updateDebugIndicator(): void;
|
|
386
|
+
/**
|
|
387
|
+
* Force-close the session without notifying the server.
|
|
388
|
+
* Prefer {@link stop} for graceful departure.
|
|
389
|
+
*/
|
|
390
|
+
terminateSession(): void;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
declare interface PixelStreamConfig {
|
|
394
|
+
nativeTouch: boolean;
|
|
395
|
+
pointerLocked: boolean;
|
|
396
|
+
pointerLockRelease: boolean;
|
|
397
|
+
suppressBrowserKeys: boolean;
|
|
398
|
+
apiEndpoint: string;
|
|
399
|
+
admissionToken: string | null;
|
|
400
|
+
appId: string | null;
|
|
401
|
+
appVersion: string | null;
|
|
402
|
+
noAutoConnect: boolean;
|
|
403
|
+
mute: boolean;
|
|
404
|
+
volume: number;
|
|
405
|
+
rendezvousPreference: number | null;
|
|
406
|
+
lingerPreference: number | null;
|
|
407
|
+
leftGracePeriod: number | null;
|
|
408
|
+
reconnectMode: 'none' | 'recover' | 'always';
|
|
409
|
+
reconnectAttempts: number;
|
|
410
|
+
reconnectStrategy: 'periodic' | 'exponential-backoff';
|
|
411
|
+
reconnectInterval: number;
|
|
412
|
+
disconnectGraceMs: number;
|
|
413
|
+
resizeMode: 'none' | 'auto' | 'pureweb' | 'pre-5.4' | '5.4+';
|
|
414
|
+
dprCap: number;
|
|
415
|
+
resolutionClamp: {
|
|
416
|
+
maxWidth: number;
|
|
417
|
+
maxHeight: number;
|
|
418
|
+
} | null;
|
|
419
|
+
queueWaitTolerance: number | null;
|
|
420
|
+
webrtcNegotiationTolerance: number | null;
|
|
421
|
+
debug: boolean;
|
|
422
|
+
controls: boolean;
|
|
423
|
+
swiftJobRequest: boolean;
|
|
424
|
+
streamerId: string | null;
|
|
425
|
+
lat: number | null;
|
|
426
|
+
lng: number | null;
|
|
427
|
+
forceRelay: boolean;
|
|
428
|
+
useMic: boolean;
|
|
429
|
+
forceMonoAudio: boolean;
|
|
430
|
+
iceBatchDelay: number;
|
|
431
|
+
streamQuality: 'low-latency' | 'balanced' | 'quality';
|
|
432
|
+
videoBitrateMin: number | null;
|
|
433
|
+
videoBitrateStart: number | null;
|
|
434
|
+
videoBitrateMax: number | null;
|
|
435
|
+
logLevel: LogLevel;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export declare function PixelStreamResizeObserverForVideo(opts: PixelStreamResizeObserverOptions): ResizeObserver;
|
|
439
|
+
|
|
440
|
+
export declare type PixelStreamResizeObserverOptions = {
|
|
441
|
+
el: HTMLVideoElement;
|
|
442
|
+
onUpdate: (u: PixelStreamResizeUpdate) => void;
|
|
443
|
+
settleMs?: number;
|
|
444
|
+
dprCap?: number | (() => number);
|
|
445
|
+
even?: boolean;
|
|
446
|
+
cssJitterPx?: number;
|
|
447
|
+
};
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* PixelStreamResizeObserverForVideo
|
|
451
|
+
*
|
|
452
|
+
* Hybrid ResizeObserver wrapper for a <video> element WITHOUT a wrapper/shell:
|
|
453
|
+
* - Width/height delta filtering
|
|
454
|
+
* - requestAnimationFrame coalescing (live updates: at most once per frame)
|
|
455
|
+
* - Debounced "final" pass (semantic commit when resizing settles)
|
|
456
|
+
* - Measures the *content box* via clientWidth/clientHeight (so borders on <video> do NOT pollute sizes)
|
|
457
|
+
* - Computes desired stream resolution in *device pixels* (CSS px * DPR), with optional DPR cap + even sizing
|
|
458
|
+
*
|
|
459
|
+
* Usage:
|
|
460
|
+
* this.resizeObserver = PixelStreamResizeObserverForVideo({
|
|
461
|
+
* el: this.videoEl,
|
|
462
|
+
* settleMs: 200,
|
|
463
|
+
* even: true,
|
|
464
|
+
* dprCap: 2, // optional
|
|
465
|
+
* onUpdate: ({ final, cssW, cssH, devW, devH, dpr }) => {
|
|
466
|
+
* // live: cheap UI math
|
|
467
|
+
* this.updateCoordTranslator({ final, cssW, cssH, devW, devH, dpr });
|
|
468
|
+
*
|
|
469
|
+
* // final: expensive / stateful: tell streamer desired resolution
|
|
470
|
+
* if (final) this.requestStreamResize(devW, devH);
|
|
471
|
+
* },
|
|
472
|
+
* });
|
|
473
|
+
*
|
|
474
|
+
* // later
|
|
475
|
+
* (this.resizeObserver as any).dispose?.(); // or this.resizeObserver.disconnect()
|
|
476
|
+
*/
|
|
477
|
+
export declare type PixelStreamResizeUpdate = {
|
|
478
|
+
final: boolean;
|
|
479
|
+
cssW: number;
|
|
480
|
+
cssH: number;
|
|
481
|
+
dpr: number;
|
|
482
|
+
devW: number;
|
|
483
|
+
devH: number;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
export declare type PixelStreamStatus = 'idle' | 'connecting' | 'authenticating' | 'connected' | 'queued' | 'rendezvoused' | 'negotiating' | 'streaming' | 'ready' | 'interrupted' | 'recovering' | 'failed' | 'ended';
|
|
487
|
+
|
|
488
|
+
declare interface ReceivedFile {
|
|
489
|
+
blob: Blob;
|
|
490
|
+
extension: string;
|
|
491
|
+
mimeType: string;
|
|
492
|
+
chunks: number;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
export declare type ResolutionClampName = 'sxga' | 'hd' | 'hdplus' | 'fhd' | 'wuxga' | 'qhd' | 'wqhd' | 'uhd';
|
|
496
|
+
|
|
497
|
+
declare interface SessionPreferences {
|
|
498
|
+
/** Seconds to wait for a peer streamer before giving up */
|
|
499
|
+
rendezvousPreference?: number;
|
|
500
|
+
/** Seconds to remain in session after all other agents leave */
|
|
501
|
+
lingerPreference?: number;
|
|
502
|
+
/** Seconds grace period before this client appears as left to other agents */
|
|
503
|
+
leftGracePeriod?: number;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
declare interface SessionStats {
|
|
507
|
+
duration: number;
|
|
508
|
+
video: {
|
|
509
|
+
codec: string | null;
|
|
510
|
+
mimeType: string | null;
|
|
511
|
+
bytesReceived: number;
|
|
512
|
+
packetsReceived: number;
|
|
513
|
+
packetsLost: number;
|
|
514
|
+
framesReceived: number;
|
|
515
|
+
framesDecoded: number;
|
|
516
|
+
framesDropped: number;
|
|
517
|
+
frameRate: number;
|
|
518
|
+
bitrate: number;
|
|
519
|
+
resolution: {
|
|
520
|
+
width: number;
|
|
521
|
+
height: number;
|
|
522
|
+
};
|
|
523
|
+
jitter: number;
|
|
524
|
+
pliCount: number;
|
|
525
|
+
nackCount: number;
|
|
526
|
+
};
|
|
527
|
+
audio: {
|
|
528
|
+
codec: string | null;
|
|
529
|
+
mimeType: string | null;
|
|
530
|
+
bytesReceived: number;
|
|
531
|
+
packetsReceived: number;
|
|
532
|
+
packetsLost: number;
|
|
533
|
+
bitrate: number;
|
|
534
|
+
jitter: number;
|
|
535
|
+
};
|
|
536
|
+
connection: {
|
|
537
|
+
iceLocalCandidateType: string | null;
|
|
538
|
+
iceRemoteCandidateType: string | null;
|
|
539
|
+
turnUsed: boolean;
|
|
540
|
+
rtt: number;
|
|
541
|
+
availableOutgoingBitrate: number;
|
|
542
|
+
protocol: string | null;
|
|
543
|
+
localAddress: string | null;
|
|
544
|
+
remoteAddress: string | null;
|
|
545
|
+
};
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
export declare interface StreamResolutionClamp {
|
|
549
|
+
maxWidth: number;
|
|
550
|
+
maxHeight: number;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
export { }
|