@arcware-cloud/pixelstreaming-websdk 1.2.17 → 1.2.18
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 +9 -0
- package/index.cjs.js +1 -1
- package/index.esm.js +1 -1
- package/index.umd.js +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +3 -0
- package/types/lib/ApplyUrlHack.d.ts +2 -0
- package/types/lib/ArcwareApplication.d.ts +48 -0
- package/types/lib/ArcwareConfig.d.ts +35 -0
- package/types/lib/ArcwareInit.d.ts +15 -0
- package/types/lib/ArcwarePixelStreaming.d.ts +98 -0
- package/types/lib/DiagnosticsCollector.d.ts +181 -0
- package/types/lib/MessageTypes.d.ts +4 -0
- package/types/lib/domain/ArcwareSettingsSchema.d.ts +209 -0
- package/types/lib/domain/ConnectionIdentifier.d.ts +27 -0
- package/types/lib/domain/EventHandler.d.ts +11 -0
- package/types/lib/domain/Session.d.ts +29 -0
- package/types/lib/domain/Stats.d.ts +36 -0
- package/types/lib/domain/debounce.d.ts +1 -0
- package/types/lib/index.d.ts +6 -0
- package/types/lib/styles/ArcwarePixelStreamingApplicationStyles.d.ts +478 -0
- package/types/lib/ui/ArcwareLogoLoader/index.d.ts +6 -0
- package/types/lib/ui/AudioButton/AudioIcon.d.ts +7 -0
- package/types/lib/ui/AudioButton/index.d.ts +15 -0
- package/types/lib/ui/LoveLetters/index.d.ts +6 -0
- package/types/lib/ui/MicButton/index.d.ts +14 -0
- package/types/lib/ui/MicIcon/index.d.ts +7 -0
- package/types/lib/ui/MicrophoneOverlay/index.d.ts +11 -0
- package/types/lib/ui/PlayIcon/index.d.ts +5 -0
- package/types/lib/ui/StopButton/index.d.ts +16 -0
- package/types/lib/ui/StopIcon/index.d.ts +5 -0
- package/types/shared/index.d.ts +1 -0
- package/types/shared/lib/Messages/ErrorMessage.d.ts +18 -0
- package/types/shared/lib/Messages/LoveLetter.d.ts +18 -0
- package/types/shared/lib/Messages/Ping.d.ts +15 -0
- package/types/shared/lib/Messages/Queue.d.ts +58 -0
- package/types/shared/lib/Messages/SessionId.d.ts +12 -0
- package/types/shared/lib/Messages/Stats.d.ts +182 -0
- package/types/shared/lib/Messages/StreamInfo.d.ts +338 -0
- package/types/shared/lib/Messages/Version.d.ts +12 -0
- package/types/shared/lib/Messages/WebSdkSettings.d.ts +96 -0
- package/types/shared/lib/Messages/index.d.ts +192 -0
- package/types/shared/lib/index.d.ts +1 -0
- package/.npmiognore +0 -1
package/README.md
CHANGED
|
@@ -80,6 +80,15 @@ For more detailed examples and advanced usage, please refer to our documentation
|
|
|
80
80
|
|
|
81
81
|
# Changelog
|
|
82
82
|
|
|
83
|
+
### 1.2.18
|
|
84
|
+
|
|
85
|
+
- fixed webpack to emit types
|
|
86
|
+
|
|
87
|
+
### 1.2.17 (broken)
|
|
88
|
+
|
|
89
|
+
- fixed diagnostics to interpred user agent and user agent data more accurately
|
|
90
|
+
- webpack did not emit types.d.ts do not use this version!
|
|
91
|
+
|
|
83
92
|
### 1.2.16
|
|
84
93
|
|
|
85
94
|
- Added "diagnostics collector" module
|
package/index.cjs.js
CHANGED
|
@@ -23351,7 +23351,7 @@ class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
|
|
|
23351
23351
|
if (!config.initialSettings.ss)
|
|
23352
23352
|
config.initialSettings.ss = exports.DefaultUrl;
|
|
23353
23353
|
super(config);
|
|
23354
|
-
this.VERSION = "1.2.
|
|
23354
|
+
this.VERSION = "1.2.18";
|
|
23355
23355
|
this.settings = settings;
|
|
23356
23356
|
this.session = new Session_1.Session();
|
|
23357
23357
|
this._initialSettings = config.initialSettings;
|
package/index.esm.js
CHANGED
|
@@ -23356,7 +23356,7 @@ class ArcwareConfig extends _epicgames_ps_lib_pixelstreamingfrontend_ue5_5__WEBP
|
|
|
23356
23356
|
if (!config.initialSettings.ss)
|
|
23357
23357
|
config.initialSettings.ss = DefaultUrl;
|
|
23358
23358
|
super(config);
|
|
23359
|
-
this.VERSION = "1.2.
|
|
23359
|
+
this.VERSION = "1.2.18";
|
|
23360
23360
|
this.settings = settings;
|
|
23361
23361
|
this.session = new _domain_Session__WEBPACK_IMPORTED_MODULE_0__.Session();
|
|
23362
23362
|
this._initialSettings = config.initialSettings;
|
package/index.umd.js
CHANGED
|
@@ -23361,7 +23361,7 @@ class ArcwareConfig extends lib_pixelstreamingfrontend_ue5_5_1.Config {
|
|
|
23361
23361
|
if (!config.initialSettings.ss)
|
|
23362
23362
|
config.initialSettings.ss = exports.DefaultUrl;
|
|
23363
23363
|
super(config);
|
|
23364
|
-
this.VERSION = "1.2.
|
|
23364
|
+
this.VERSION = "1.2.18";
|
|
23365
23365
|
this.settings = settings;
|
|
23366
23366
|
this.session = new Session_1.Session();
|
|
23367
23367
|
this._initialSettings = config.initialSettings;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcware-cloud/pixelstreaming-websdk",
|
|
3
3
|
"description": "WebSDK for easy implementation of pixel streaming with Arcware Cloud Services. Heavily based on the '@epicgames-ps' library.",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.18",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./index.umd.js",
|
|
7
7
|
"module": "./index.umd.js",
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Application, UIOptions } from "@epicgames-ps/lib-pixelstreamingfrontend-ui-ue5.5";
|
|
2
|
+
import { ArcwarePixelStreaming } from "./ArcwarePixelStreaming";
|
|
3
|
+
export declare class ArcwareApplication extends Application {
|
|
4
|
+
static Flags: {
|
|
5
|
+
new (): {};
|
|
6
|
+
noSession: "noSession";
|
|
7
|
+
};
|
|
8
|
+
stream: ArcwarePixelStreaming;
|
|
9
|
+
private videoElementParent;
|
|
10
|
+
private parentElement;
|
|
11
|
+
private responseCallback;
|
|
12
|
+
private webRtcController;
|
|
13
|
+
get rootElement(): HTMLElement;
|
|
14
|
+
private ArcwareSection;
|
|
15
|
+
constructor(options: UIOptions & {
|
|
16
|
+
stream: ArcwarePixelStreaming;
|
|
17
|
+
});
|
|
18
|
+
addLoveLetterhandler(): void;
|
|
19
|
+
/** Set's and resets hidden state of "additional" UI Elements.
|
|
20
|
+
* For example buttons or connection icon.
|
|
21
|
+
* These will fade in through css animation upon the videoInitialized event.
|
|
22
|
+
* At this point in time the streamInfo is already processed.
|
|
23
|
+
*/
|
|
24
|
+
private uiElementsVisibility;
|
|
25
|
+
private adjustSettingsPanel;
|
|
26
|
+
private createAudioToggleButton;
|
|
27
|
+
private createMicToggleButton;
|
|
28
|
+
private createStopButton;
|
|
29
|
+
private uiDefaultButtonVisibilty;
|
|
30
|
+
private preventDefaultKeyboardEvents;
|
|
31
|
+
private autoPlayHandler;
|
|
32
|
+
/** Request a response from you UE Application.
|
|
33
|
+
* The returned response depends on the implementation of your UE Application.
|
|
34
|
+
* It can be used to request information from the application, such as:
|
|
35
|
+
* - a state to update your custom ui
|
|
36
|
+
* - get the url to the pdf it uploaded to some remote service of yours
|
|
37
|
+
* - the id of the save-game
|
|
38
|
+
* .. anything else you could imagine.
|
|
39
|
+
*/
|
|
40
|
+
getApplicationResponse(callback: (response: string) => void): void;
|
|
41
|
+
applicationResponse(response: string): void;
|
|
42
|
+
private applyArcwareStyles;
|
|
43
|
+
/** Emit an event towards the UE Application.
|
|
44
|
+
* Mainly used to bubble events like a button press or other command inputs towards the UE Application.
|
|
45
|
+
*/
|
|
46
|
+
emitUIInteraction(descriptor: object | string): void;
|
|
47
|
+
private addTextToConnectOverlay;
|
|
48
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Config, ConfigParams } from "@epicgames-ps/lib-pixelstreamingfrontend-ue5.5";
|
|
2
|
+
import { Session } from "./domain/Session";
|
|
3
|
+
import { Settings } from "./domain/ArcwareSettingsSchema";
|
|
4
|
+
/** Default arcware signalling endpoint. */
|
|
5
|
+
export declare const DefaultUrl: "wss://signalling-client.ragnarok.arcware.cloud";
|
|
6
|
+
export interface ArcwareConfigParams extends ConfigParams {
|
|
7
|
+
settings: Settings;
|
|
8
|
+
}
|
|
9
|
+
export declare class ArcwareConfig extends Config {
|
|
10
|
+
/**
|
|
11
|
+
* Can be used to fetch projectId and shareId from the current url.
|
|
12
|
+
* Example:
|
|
13
|
+
* /something/:projectId/:shareId/something?something => { projectId, shareId }
|
|
14
|
+
* /:projectId => { projectId }
|
|
15
|
+
* /:shareId => { shareId }
|
|
16
|
+
* /:shareId/:projectId => { projectId, shareId }
|
|
17
|
+
*
|
|
18
|
+
* The projectId must be uuidv4.
|
|
19
|
+
* The shareId must be "shareId-" prefixed.
|
|
20
|
+
*
|
|
21
|
+
* Usage:
|
|
22
|
+
* // This will spread the projectId and the shareId into the settings. Define anything you want to override after the spread operation.
|
|
23
|
+
* new ArcwareConfig({ settings: { ...ArcwareConfig.PickIdsOfUrl() } });
|
|
24
|
+
*/
|
|
25
|
+
static PickIdsOfUrl(): Pick<Settings, "shareId" | "projectId">;
|
|
26
|
+
readonly session: Session;
|
|
27
|
+
readonly settings: Settings;
|
|
28
|
+
private _initialSettings;
|
|
29
|
+
readonly VERSION = "1.2.18";
|
|
30
|
+
constructor(config: ArcwareConfigParams);
|
|
31
|
+
/** Setup connection string. */
|
|
32
|
+
get urlFlags(): string;
|
|
33
|
+
get initialSettings(): any;
|
|
34
|
+
modifyInitialSettings(mouseLock: boolean): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ArcwareConfig, ArcwareConfigParams } from "./ArcwareConfig";
|
|
2
|
+
import { ArcwarePixelStreaming } from "./ArcwarePixelStreaming";
|
|
3
|
+
import { ArcwareApplication } from "./ArcwareApplication";
|
|
4
|
+
type DeepPartial<T> = T extends Function ? T : T extends object ? {
|
|
5
|
+
[P in keyof T]?: DeepPartial<T[P]>;
|
|
6
|
+
} : T;
|
|
7
|
+
export declare function ArcwareInit({ shareId, projectId }: {
|
|
8
|
+
shareId?: string;
|
|
9
|
+
projectId?: string;
|
|
10
|
+
}, configuration?: DeepPartial<ArcwareConfigParams>, forceRefresh?: boolean): {
|
|
11
|
+
Config: ArcwareConfig;
|
|
12
|
+
PixelStreaming: ArcwarePixelStreaming;
|
|
13
|
+
Application: ArcwareApplication;
|
|
14
|
+
};
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Messages } from "@arcware-cloud/shared-pixelstreaming-websdk";
|
|
2
|
+
import { PixelStreaming, PixelStreamingOverrides } from "@epicgames-ps/lib-pixelstreamingfrontend-ue5.5";
|
|
3
|
+
import { ArcwareConfig } from "./ArcwareConfig";
|
|
4
|
+
import { EventHandler } from "./domain/EventHandler";
|
|
5
|
+
import { Session } from "./domain/Session";
|
|
6
|
+
import { WebsocketState } from "./domain/ConnectionIdentifier";
|
|
7
|
+
export declare class ArcwarePixelStreaming extends PixelStreaming {
|
|
8
|
+
/** Override default config with ArcwareConfig. */
|
|
9
|
+
config: ArcwareConfig;
|
|
10
|
+
streamInfo?: Messages.StreamInfo;
|
|
11
|
+
loveLettersContainer: HTMLDivElement | undefined;
|
|
12
|
+
private loveLettersList;
|
|
13
|
+
private loveLettersQueue;
|
|
14
|
+
private isProcessingQueue;
|
|
15
|
+
private microphoneOverlay;
|
|
16
|
+
private diagnosticsCollector;
|
|
17
|
+
/** Returns a list of WebSocketStates of all PixelStreaming Instances generated. */
|
|
18
|
+
get WebsocketStates(): WebsocketState[];
|
|
19
|
+
/** Counts all active PixelStreaming Instances generated. (CONNECTING & CONNECTED) */
|
|
20
|
+
get ActiveInstances(): () => number;
|
|
21
|
+
/** Returns this PixelStreaming Instances websocket state. */
|
|
22
|
+
get websocketState(): WebsocketState;
|
|
23
|
+
constructor(config: ArcwareConfig, overrides?: PixelStreamingOverrides);
|
|
24
|
+
/** Getter for the session object. */
|
|
25
|
+
get session(): Session;
|
|
26
|
+
/**
|
|
27
|
+
* * * * * * *
|
|
28
|
+
* Listen *
|
|
29
|
+
* * * * * * *
|
|
30
|
+
*/
|
|
31
|
+
/** On version requested, the version of the WebSDK would be returned. */
|
|
32
|
+
private onVersion;
|
|
33
|
+
/** On ping the session creation timestamp will be updated. */
|
|
34
|
+
private onPing;
|
|
35
|
+
/** Handle incoming configurations. */
|
|
36
|
+
private onStreamInfo;
|
|
37
|
+
/** On ping the session creation timestamp will be updated. */
|
|
38
|
+
readonly queueHandler: EventHandler<{
|
|
39
|
+
type?: "queue";
|
|
40
|
+
queue?: {
|
|
41
|
+
index?: number;
|
|
42
|
+
queueLength?: number;
|
|
43
|
+
waited?: number;
|
|
44
|
+
estimatedWaitTime?: number;
|
|
45
|
+
averageWaitTime?: number;
|
|
46
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
47
|
+
};
|
|
48
|
+
}>;
|
|
49
|
+
private onQueue;
|
|
50
|
+
/** Error receiver. */
|
|
51
|
+
readonly errorHandler: EventHandler<{
|
|
52
|
+
type?: "error";
|
|
53
|
+
code?: number;
|
|
54
|
+
reason?: string;
|
|
55
|
+
verbosity?: number;
|
|
56
|
+
}>;
|
|
57
|
+
private onError;
|
|
58
|
+
/** LoveLetter */
|
|
59
|
+
readonly loveLetterHandler: EventHandler<{
|
|
60
|
+
type?: "letter";
|
|
61
|
+
reason?: string;
|
|
62
|
+
code?: number;
|
|
63
|
+
verbosity?: number;
|
|
64
|
+
}>;
|
|
65
|
+
private onLoveLetter;
|
|
66
|
+
/** SessionId */
|
|
67
|
+
readonly sessionIdHandler: EventHandler<string>;
|
|
68
|
+
private onSessionId;
|
|
69
|
+
/** VideoInitialized */
|
|
70
|
+
readonly videoInitializedHandler: EventHandler<never>;
|
|
71
|
+
private onVideoInitialized;
|
|
72
|
+
/** WebSocket Close */
|
|
73
|
+
readonly websocketOnCloseHandler: EventHandler<CloseEvent>;
|
|
74
|
+
/** Adding a zod-safe handler. */
|
|
75
|
+
private addMessageHandler;
|
|
76
|
+
/**
|
|
77
|
+
* * * * * *
|
|
78
|
+
* Send *
|
|
79
|
+
* * * * * *
|
|
80
|
+
*/
|
|
81
|
+
private sendStats;
|
|
82
|
+
private send;
|
|
83
|
+
private handleResolutionChange;
|
|
84
|
+
private applyResolutionIfPlaying;
|
|
85
|
+
removePlayer(): void;
|
|
86
|
+
private handleMouseLock;
|
|
87
|
+
initLoveLettersContainer(): void;
|
|
88
|
+
private pushLetter;
|
|
89
|
+
private processLoveLetterQueue;
|
|
90
|
+
private handleRemoveLoveLetters;
|
|
91
|
+
toggleAudio(videoElement: HTMLVideoElement, enabled: boolean): void;
|
|
92
|
+
private createMicrophoneOverlay;
|
|
93
|
+
toggleMic(enable: boolean, isDefault: boolean): void;
|
|
94
|
+
private wrapWebSocketOnCloseHandler;
|
|
95
|
+
onStreamingStateChange(callback: (isStreaming: boolean) => void): void;
|
|
96
|
+
private removeXRIconIfDisabled;
|
|
97
|
+
private injectCustomUI;
|
|
98
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DiagnosticsCollector.ts
|
|
3
|
+
* Lightweight, privacy-aware client diagnostics for troubleshooting + analytics.
|
|
4
|
+
* WebRTC collection intentionally omitted (to add later).
|
|
5
|
+
*
|
|
6
|
+
* Notes:
|
|
7
|
+
* - Some fields are best-effort due to browser restrictions; they're nullable.
|
|
8
|
+
* - Bandwidth probe requires a small binary served with:
|
|
9
|
+
* Content-Type: application/octet-stream
|
|
10
|
+
* Content-Encoding: identity
|
|
11
|
+
* Cache-Control: no-store
|
|
12
|
+
* Default location: /diag/probe.bin
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* These interfaces need to be copied manually from ITicket.ts for now if the interface changes there
|
|
16
|
+
* The way how webpack, rollup and this whole mono repo is setup up, I cannot just import it......
|
|
17
|
+
*/
|
|
18
|
+
export interface IDiagnostics {
|
|
19
|
+
device?: Device;
|
|
20
|
+
network?: Network;
|
|
21
|
+
powerHints?: PowerHints;
|
|
22
|
+
runtime?: Runtime;
|
|
23
|
+
timestamps?: Timestamps;
|
|
24
|
+
webrtc?: Webrtc;
|
|
25
|
+
}
|
|
26
|
+
export interface Device {
|
|
27
|
+
architecture?: null | string;
|
|
28
|
+
bitness?: null | string;
|
|
29
|
+
codecs?: Codecs;
|
|
30
|
+
deviceMemory?: number | null;
|
|
31
|
+
hardwareConcurrency?: number | null;
|
|
32
|
+
model?: null | string;
|
|
33
|
+
orientation?: Orientation | null;
|
|
34
|
+
touchSupport?: boolean;
|
|
35
|
+
type?: Type;
|
|
36
|
+
vendor?: null | string;
|
|
37
|
+
webgl?: boolean | null;
|
|
38
|
+
}
|
|
39
|
+
export interface Codecs {
|
|
40
|
+
h264?: boolean;
|
|
41
|
+
hevc?: boolean;
|
|
42
|
+
}
|
|
43
|
+
export declare enum Orientation {
|
|
44
|
+
Landscape = "landscape",
|
|
45
|
+
Portrait = "portrait"
|
|
46
|
+
}
|
|
47
|
+
export declare enum Type {
|
|
48
|
+
Desktop = "desktop",
|
|
49
|
+
Mobile = "mobile",
|
|
50
|
+
Tablet = "tablet"
|
|
51
|
+
}
|
|
52
|
+
export interface Network {
|
|
53
|
+
downlinkMbps?: number | null;
|
|
54
|
+
effectiveType?: null | string;
|
|
55
|
+
measuredDownlinkMbps?: number | null;
|
|
56
|
+
rttMs?: number | null;
|
|
57
|
+
type?: null | string;
|
|
58
|
+
}
|
|
59
|
+
export interface PowerHints {
|
|
60
|
+
prefersReducedData?: boolean | null;
|
|
61
|
+
prefersReducedMotion?: boolean | null;
|
|
62
|
+
saveData?: boolean | null;
|
|
63
|
+
}
|
|
64
|
+
export interface Runtime {
|
|
65
|
+
browser?: Browser;
|
|
66
|
+
os?: OS;
|
|
67
|
+
}
|
|
68
|
+
export interface Browser {
|
|
69
|
+
family?: string;
|
|
70
|
+
version?: null | string;
|
|
71
|
+
}
|
|
72
|
+
export interface OS {
|
|
73
|
+
family?: string;
|
|
74
|
+
version?: null | string;
|
|
75
|
+
}
|
|
76
|
+
export interface Timestamps {
|
|
77
|
+
collectedAt?: number;
|
|
78
|
+
}
|
|
79
|
+
export interface Webrtc {
|
|
80
|
+
candidatePairId?: null | string;
|
|
81
|
+
dtlsCipher?: null | string;
|
|
82
|
+
localCandidateType?: null | string;
|
|
83
|
+
networkType?: null | string;
|
|
84
|
+
protocol?: null | string;
|
|
85
|
+
remoteCandidateType?: null | string;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Options that control how the DiagnosticsCollector behaves.
|
|
89
|
+
*
|
|
90
|
+
* You don’t *need* to set these for a basic Pixel Streaming website — the defaults
|
|
91
|
+
* are good enough. But in production, these knobs let you control cost, UX impact,
|
|
92
|
+
* and flexibility without changing the code.
|
|
93
|
+
*/
|
|
94
|
+
export interface DiagnosticsCollectorOptions {
|
|
95
|
+
/**
|
|
96
|
+
* Run a synthetic bandwidth probe? (default: true)
|
|
97
|
+
*
|
|
98
|
+
* - When true: the collector fetches a small binary file (see `probeUrl`)
|
|
99
|
+
* and measures download speed to estimate available bandwidth.
|
|
100
|
+
* - Why it matters: gives you a ground-truth Mbps measurement that the
|
|
101
|
+
* browser doesn’t always expose.
|
|
102
|
+
* - Downsides: adds one extra network request per session.
|
|
103
|
+
* - When to disable: if you want *zero* extra traffic (e.g. privacy-sensitive
|
|
104
|
+
* deployments, embedded use cases).
|
|
105
|
+
*/
|
|
106
|
+
enableBandwidthProbe?: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* URL of the probe file used for bandwidth measurement. (default: "/diag/probe.bin")
|
|
109
|
+
*
|
|
110
|
+
* - Must be served as raw binary with headers:
|
|
111
|
+
* Content-Type: application/octet-stream
|
|
112
|
+
* Content-Encoding: identity
|
|
113
|
+
* Cache-Control: no-store
|
|
114
|
+
* - Size: keep small (200–500 KB) for quick, accurate tests.
|
|
115
|
+
* - Why you’d override: if you host assets on a CDN or want different probe
|
|
116
|
+
* files per region/environment.
|
|
117
|
+
*/
|
|
118
|
+
probeUrl?: string;
|
|
119
|
+
/**
|
|
120
|
+
* Respect the user’s "Data Saver" mode? (default: true)
|
|
121
|
+
*
|
|
122
|
+
* - The browser exposes `navigator.connection.saveData`.
|
|
123
|
+
* - When true: if saveData === true, the collector skips the bandwidth probe
|
|
124
|
+
* (to avoid wasting data).
|
|
125
|
+
* - Why it matters: good UX and respectful to users on metered/limited data.
|
|
126
|
+
* - When to disable: if accurate bandwidth numbers are critical even for
|
|
127
|
+
* Data Saver users (rare).
|
|
128
|
+
*/
|
|
129
|
+
respectSaveData?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Sampling rate for diagnostics collection. (range: 0.0–1.0, default: 1.0)
|
|
132
|
+
*
|
|
133
|
+
* - 1.0 (100%): collect diagnostics for every session (ideal in dev/beta).
|
|
134
|
+
* - 0.1 (10%): collect for ~10% of sessions (reduces storage & processing costs).
|
|
135
|
+
* - Why it matters: in production, detailed telemetry from *every* session
|
|
136
|
+
* may be too costly or noisy. Sampling still gives you trends.
|
|
137
|
+
* - How it works: collector rolls a random number per session; only collects
|
|
138
|
+
* if value < sampleRate.
|
|
139
|
+
*/
|
|
140
|
+
sampleRate?: number;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* DiagnosticsCollector
|
|
144
|
+
*/
|
|
145
|
+
export declare class DiagnosticsCollector {
|
|
146
|
+
private opts;
|
|
147
|
+
constructor(opts?: DiagnosticsCollectorOptions);
|
|
148
|
+
/**
|
|
149
|
+
* Collect the diagnostics payload.
|
|
150
|
+
*/
|
|
151
|
+
collect(): Promise<IDiagnostics>;
|
|
152
|
+
/**
|
|
153
|
+
* Collect a safe subset of WebRTC stats once PC is connected.
|
|
154
|
+
*/
|
|
155
|
+
collectWebRTC(pc: RTCPeerConnection): Promise<IDiagnostics["webrtc"]>;
|
|
156
|
+
/**
|
|
157
|
+
* Helper to embed diagnostics in a hello envelope.
|
|
158
|
+
*/
|
|
159
|
+
buildHelloEnvelope(base: Record<string, any>, pc?: RTCPeerConnection): Promise<{
|
|
160
|
+
ext: {
|
|
161
|
+
diag: IDiagnostics;
|
|
162
|
+
};
|
|
163
|
+
}>;
|
|
164
|
+
private shouldSample;
|
|
165
|
+
private hasTouch;
|
|
166
|
+
private getOrientation;
|
|
167
|
+
private hasWebGL;
|
|
168
|
+
/**
|
|
169
|
+
* Heuristic device type: best-effort only.
|
|
170
|
+
* Tries UA-CH, then UA fallback, then touch + screen size heuristics.
|
|
171
|
+
*/
|
|
172
|
+
private inferDeviceType;
|
|
173
|
+
private getPowerHints;
|
|
174
|
+
private getNetworkInfo;
|
|
175
|
+
private maybeMeasureBandwidth;
|
|
176
|
+
private withCacheBuster;
|
|
177
|
+
private getCodecSupport;
|
|
178
|
+
private supportsCodec;
|
|
179
|
+
private uaInfoCache;
|
|
180
|
+
private getUAInfo;
|
|
181
|
+
}
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Arcware Settings. */
|
|
3
|
+
export declare const ArcwareSettingsSchema: z.ZodObject<{
|
|
4
|
+
/** Overwrites the Session-Tool and uses the provided session instead. */
|
|
5
|
+
session: z.ZodOptional<z.ZodString>;
|
|
6
|
+
/** Can be used to be added to the request in order to verify access to private projects.
|
|
7
|
+
* For internal use only. => Preview page.
|
|
8
|
+
*/
|
|
9
|
+
token: z.ZodOptional<z.ZodString>;
|
|
10
|
+
/** @deprecated in there for legacy use. Can only be used when token is provided. */
|
|
11
|
+
bypass: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
/** Handler for server side error messages. */
|
|
13
|
+
errorHandler: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
14
|
+
type: z.ZodLiteral<"error">;
|
|
15
|
+
code: z.ZodNumber;
|
|
16
|
+
reason: z.ZodString;
|
|
17
|
+
verbosity: z.ZodNumber;
|
|
18
|
+
}, "strip", z.ZodTypeAny, {
|
|
19
|
+
type?: "error";
|
|
20
|
+
code?: number;
|
|
21
|
+
reason?: string;
|
|
22
|
+
verbosity?: number;
|
|
23
|
+
}, {
|
|
24
|
+
type?: "error";
|
|
25
|
+
code?: number;
|
|
26
|
+
reason?: string;
|
|
27
|
+
verbosity?: number;
|
|
28
|
+
}>], z.ZodUnknown>, z.ZodVoid>>;
|
|
29
|
+
/** Handler for queue events. */
|
|
30
|
+
queueHandler: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
31
|
+
type: z.ZodLiteral<"queue">;
|
|
32
|
+
queue: z.ZodObject<{
|
|
33
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
/** Can be used to be added to the request in order to verify access to private projects.
|
|
35
|
+
* For internal use only. => Preview page.
|
|
36
|
+
*/
|
|
37
|
+
queueLength: z.ZodOptional<z.ZodNumber>;
|
|
38
|
+
waited: z.ZodOptional<z.ZodNumber>;
|
|
39
|
+
estimatedWaitTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
40
|
+
averageWaitTime: z.ZodNullable<z.ZodOptional<z.ZodNumber>>;
|
|
41
|
+
valueType: z.ZodEnum<["milliseconds", "seconds", "minutes", "hours", "days"]>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
index?: number;
|
|
44
|
+
queueLength?: number;
|
|
45
|
+
waited?: number;
|
|
46
|
+
estimatedWaitTime?: number;
|
|
47
|
+
averageWaitTime?: number;
|
|
48
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
49
|
+
}, {
|
|
50
|
+
index?: number;
|
|
51
|
+
queueLength?: number;
|
|
52
|
+
waited?: number;
|
|
53
|
+
estimatedWaitTime?: number;
|
|
54
|
+
averageWaitTime?: number;
|
|
55
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
56
|
+
}>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
type?: "queue";
|
|
59
|
+
queue?: {
|
|
60
|
+
index?: number;
|
|
61
|
+
queueLength?: number;
|
|
62
|
+
waited?: number;
|
|
63
|
+
estimatedWaitTime?: number;
|
|
64
|
+
averageWaitTime?: number;
|
|
65
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
66
|
+
};
|
|
67
|
+
}, {
|
|
68
|
+
type?: "queue";
|
|
69
|
+
queue?: {
|
|
70
|
+
index?: number;
|
|
71
|
+
queueLength?: number;
|
|
72
|
+
waited?: number;
|
|
73
|
+
estimatedWaitTime?: number;
|
|
74
|
+
averageWaitTime?: number;
|
|
75
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
76
|
+
};
|
|
77
|
+
}>], z.ZodUnknown>, z.ZodVoid>>;
|
|
78
|
+
/** Handler for sessionId message. */
|
|
79
|
+
sessionIdHandler: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodString], z.ZodUnknown>, z.ZodVoid>>;
|
|
80
|
+
/** Handler for love letters.
|
|
81
|
+
* "LoveLetters" are send from backend to the SDK to state what phase the connection currently is in. */
|
|
82
|
+
loveLetterHandler: z.ZodOptional<z.ZodFunction<z.ZodTuple<[z.ZodObject<{
|
|
83
|
+
type: z.ZodLiteral<"letter">;
|
|
84
|
+
reason: z.ZodString;
|
|
85
|
+
code: z.ZodNumber;
|
|
86
|
+
verbosity: z.ZodNumber;
|
|
87
|
+
}, "strip", z.ZodTypeAny, {
|
|
88
|
+
type?: "letter";
|
|
89
|
+
reason?: string;
|
|
90
|
+
code?: number;
|
|
91
|
+
verbosity?: number;
|
|
92
|
+
}, {
|
|
93
|
+
type?: "letter";
|
|
94
|
+
reason?: string;
|
|
95
|
+
code?: number;
|
|
96
|
+
verbosity?: number;
|
|
97
|
+
}>], z.ZodUnknown>, z.ZodVoid>>;
|
|
98
|
+
/** Show or hide the fullscreen button. */
|
|
99
|
+
fullscreenButton: z.ZodOptional<z.ZodBoolean>;
|
|
100
|
+
/** Show or hide the settings button. */
|
|
101
|
+
settingsButton: z.ZodOptional<z.ZodBoolean>;
|
|
102
|
+
/** Show or hide the info button. */
|
|
103
|
+
infoButton: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
/** Show or hide the audio button. */
|
|
105
|
+
audioButton: z.ZodOptional<z.ZodBoolean>;
|
|
106
|
+
/** Show or hide the microphone button. */
|
|
107
|
+
micButton: z.ZodOptional<z.ZodBoolean>;
|
|
108
|
+
/** Show or hide the microphone button. */
|
|
109
|
+
stopButton: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
/** Show or hide the connectionStrengthIcon button. */
|
|
111
|
+
connectionStrengthIcon: z.ZodOptional<z.ZodBoolean>;
|
|
112
|
+
/** ShareId, used for sharing your project.
|
|
113
|
+
* Using ArcwareInit will set this required property for you. */
|
|
114
|
+
shareId: z.ZodOptional<z.ZodString>;
|
|
115
|
+
/** Id of your project, only required if your shareId refers to multiple projects.
|
|
116
|
+
* Using ArcwareInit will set this required property for you. */
|
|
117
|
+
projectId: z.ZodOptional<z.ZodString>;
|
|
118
|
+
/** Enable/Disable LoveLetter logging to the console. */
|
|
119
|
+
loveLetterLogging: z.ZodOptional<z.ZodBoolean>;
|
|
120
|
+
/** Enable/Disable Connection Identifier logging to the console. */
|
|
121
|
+
connectionIdentifierLoggingDisabled: z.ZodOptional<z.ZodBoolean>;
|
|
122
|
+
/** Width with which instance should be started */
|
|
123
|
+
startWidth: z.ZodOptional<z.ZodNumber>;
|
|
124
|
+
/** Height with which instance should be started */
|
|
125
|
+
startHeight: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
}, "strip", z.ZodTypeAny, {
|
|
127
|
+
session?: string;
|
|
128
|
+
token?: string;
|
|
129
|
+
bypass?: boolean;
|
|
130
|
+
errorHandler?: (args_0: {
|
|
131
|
+
type?: "error";
|
|
132
|
+
code?: number;
|
|
133
|
+
reason?: string;
|
|
134
|
+
verbosity?: number;
|
|
135
|
+
}, ...args_1: unknown[]) => void;
|
|
136
|
+
queueHandler?: (args_0: {
|
|
137
|
+
type?: "queue";
|
|
138
|
+
queue?: {
|
|
139
|
+
index?: number;
|
|
140
|
+
queueLength?: number;
|
|
141
|
+
waited?: number;
|
|
142
|
+
estimatedWaitTime?: number;
|
|
143
|
+
averageWaitTime?: number;
|
|
144
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
145
|
+
};
|
|
146
|
+
}, ...args_1: unknown[]) => void;
|
|
147
|
+
sessionIdHandler?: (args_0: string, ...args_1: unknown[]) => void;
|
|
148
|
+
loveLetterHandler?: (args_0: {
|
|
149
|
+
type?: "letter";
|
|
150
|
+
reason?: string;
|
|
151
|
+
code?: number;
|
|
152
|
+
verbosity?: number;
|
|
153
|
+
}, ...args_1: unknown[]) => void;
|
|
154
|
+
fullscreenButton?: boolean;
|
|
155
|
+
settingsButton?: boolean;
|
|
156
|
+
infoButton?: boolean;
|
|
157
|
+
audioButton?: boolean;
|
|
158
|
+
micButton?: boolean;
|
|
159
|
+
stopButton?: boolean;
|
|
160
|
+
connectionStrengthIcon?: boolean;
|
|
161
|
+
shareId?: string;
|
|
162
|
+
projectId?: string;
|
|
163
|
+
loveLetterLogging?: boolean;
|
|
164
|
+
connectionIdentifierLoggingDisabled?: boolean;
|
|
165
|
+
startWidth?: number;
|
|
166
|
+
startHeight?: number;
|
|
167
|
+
}, {
|
|
168
|
+
session?: string;
|
|
169
|
+
token?: string;
|
|
170
|
+
bypass?: boolean;
|
|
171
|
+
errorHandler?: (args_0: {
|
|
172
|
+
type?: "error";
|
|
173
|
+
code?: number;
|
|
174
|
+
reason?: string;
|
|
175
|
+
verbosity?: number;
|
|
176
|
+
}, ...args_1: unknown[]) => void;
|
|
177
|
+
queueHandler?: (args_0: {
|
|
178
|
+
type?: "queue";
|
|
179
|
+
queue?: {
|
|
180
|
+
index?: number;
|
|
181
|
+
queueLength?: number;
|
|
182
|
+
waited?: number;
|
|
183
|
+
estimatedWaitTime?: number;
|
|
184
|
+
averageWaitTime?: number;
|
|
185
|
+
valueType?: "milliseconds" | "seconds" | "minutes" | "hours" | "days";
|
|
186
|
+
};
|
|
187
|
+
}, ...args_1: unknown[]) => void;
|
|
188
|
+
sessionIdHandler?: (args_0: string, ...args_1: unknown[]) => void;
|
|
189
|
+
loveLetterHandler?: (args_0: {
|
|
190
|
+
type?: "letter";
|
|
191
|
+
reason?: string;
|
|
192
|
+
code?: number;
|
|
193
|
+
verbosity?: number;
|
|
194
|
+
}, ...args_1: unknown[]) => void;
|
|
195
|
+
fullscreenButton?: boolean;
|
|
196
|
+
settingsButton?: boolean;
|
|
197
|
+
infoButton?: boolean;
|
|
198
|
+
audioButton?: boolean;
|
|
199
|
+
micButton?: boolean;
|
|
200
|
+
stopButton?: boolean;
|
|
201
|
+
connectionStrengthIcon?: boolean;
|
|
202
|
+
shareId?: string;
|
|
203
|
+
projectId?: string;
|
|
204
|
+
loveLetterLogging?: boolean;
|
|
205
|
+
connectionIdentifierLoggingDisabled?: boolean;
|
|
206
|
+
startWidth?: number;
|
|
207
|
+
startHeight?: number;
|
|
208
|
+
}>;
|
|
209
|
+
export type Settings = z.infer<typeof ArcwareSettingsSchema>;
|