@reactor-team/js-sdk 3.0.1 → 3.1.0
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/dist/index.cjs +416 -98
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -16
- package/dist/index.d.ts +77 -16
- package/dist/index.js +416 -98
- package/dist/index.js.map +1 -1
- package/dist/wasm/reactor_wasm.d.ts +42 -0
- package/dist/wasm/reactor_wasm.js +40 -5
- package/dist/wasm/reactor_wasm_bg.wasm +0 -0
- package/dist/wasm/reactor_wasm_bg.wasm.d.ts +1 -0
- package/package.json +1 -1
|
@@ -144,6 +144,36 @@ export interface ReactorError {
|
|
|
144
144
|
timestamp_ms: number;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
/** One track's WebRTC quality reading taken from `getStats()`, for
|
|
148
|
+
* `sendClientStats`. */
|
|
149
|
+
export interface ClientTrackStat {
|
|
150
|
+
/** When this reading was taken, epoch milliseconds (e.g. `Date.now()`). */
|
|
151
|
+
timestamp: number;
|
|
152
|
+
trackName: string;
|
|
153
|
+
kind: TrackKind;
|
|
154
|
+
direction: TrackDirection;
|
|
155
|
+
/** The codec in use for this track, e.g. "vp9", "h264", "opus". */
|
|
156
|
+
codec: string;
|
|
157
|
+
/** Whether the client currently has this track paused. */
|
|
158
|
+
paused: boolean;
|
|
159
|
+
/** Named numeric readings, keyed by W3C webrtc-stats names in snake_case,
|
|
160
|
+
* e.g. bitrate_bps, frames_per_second, packets_lost, packets_received,
|
|
161
|
+
* jitter_ms, round_trip_time_ms, frames_decoded, frames_dropped,
|
|
162
|
+
* frame_width, frame_height, nack_count, keyframe_requests. A reading the
|
|
163
|
+
* client couldn't take is left out, never sent as 0. */
|
|
164
|
+
metrics: Record<string, number>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** A connection-wide reading, not tied to any one track — for
|
|
168
|
+
* `sendClientStats`. Sent on every batch; one-time facts such as
|
|
169
|
+
* time_to_connect_ms ride only the first batch after connecting. */
|
|
170
|
+
export interface ClientConnectionStat {
|
|
171
|
+
timestamp: number;
|
|
172
|
+
/** Named numeric readings, e.g. available_outgoing_bitrate_bps,
|
|
173
|
+
* connection_rtt_ms, time_to_connect_ms. */
|
|
174
|
+
metrics: Record<string, number>;
|
|
175
|
+
}
|
|
176
|
+
|
|
147
177
|
export type StatusListener = (status: ReactorStatus) => void;
|
|
148
178
|
export type SessionIdListener = (sessionId: string | undefined) => void;
|
|
149
179
|
export type MessageListener = (message: ReactorMessage) => void;
|
|
@@ -293,6 +323,17 @@ export class ReactorClient {
|
|
|
293
323
|
* Resume a paused track.
|
|
294
324
|
*/
|
|
295
325
|
resumeTrack(name: string): Promise<void>;
|
|
326
|
+
/**
|
|
327
|
+
* Report a batch of client-observed WebRTC quality readings to the runtime.
|
|
328
|
+
*
|
|
329
|
+
* Fire-and-forget, like the automatic heartbeat: this returns once the
|
|
330
|
+
* frame is handed to the control channel, not once the runtime has
|
|
331
|
+
* processed it. The runtime attaches this connection's own session and
|
|
332
|
+
* connection identity to the batch — nothing here needs to (or can)
|
|
333
|
+
* carry that itself. `connectionStat` carries the connection-wide
|
|
334
|
+
* readings and is normally present on every batch.
|
|
335
|
+
*/
|
|
336
|
+
sendClientStats(track_stats: ClientTrackStat[], connection_stat: ClientConnectionStat | undefined): void;
|
|
296
337
|
/**
|
|
297
338
|
* Send a command to the model and resolve with its reply.
|
|
298
339
|
*
|
|
@@ -389,6 +430,7 @@ export interface InitOutput {
|
|
|
389
430
|
readonly reactorclient_requestRecording: (a: number) => any;
|
|
390
431
|
readonly reactorclient_requestSchema: (a: number) => any;
|
|
391
432
|
readonly reactorclient_resumeTrack: (a: number, b: number, c: number) => any;
|
|
433
|
+
readonly reactorclient_sendClientStats: (a: number, b: any, c: any) => [number, number];
|
|
392
434
|
readonly reactorclient_sendCommand: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
393
435
|
readonly reactorclient_sessionId: (a: number) => [number, number];
|
|
394
436
|
readonly reactorclient_sessionInfo: (a: number) => [number, number, number];
|
|
@@ -281,6 +281,24 @@ export class ReactorClient {
|
|
|
281
281
|
const ret = wasm.reactorclient_resumeTrack(this.__wbg_ptr, ptr0, len0);
|
|
282
282
|
return ret;
|
|
283
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Report a batch of client-observed WebRTC quality readings to the runtime.
|
|
286
|
+
*
|
|
287
|
+
* Fire-and-forget, like the automatic heartbeat: this returns once the
|
|
288
|
+
* frame is handed to the control channel, not once the runtime has
|
|
289
|
+
* processed it. The runtime attaches this connection's own session and
|
|
290
|
+
* connection identity to the batch — nothing here needs to (or can)
|
|
291
|
+
* carry that itself. `connectionStat` carries the connection-wide
|
|
292
|
+
* readings and is normally present on every batch.
|
|
293
|
+
* @param {ClientTrackStat[]} track_stats
|
|
294
|
+
* @param {ClientConnectionStat | undefined} connection_stat
|
|
295
|
+
*/
|
|
296
|
+
sendClientStats(track_stats, connection_stat) {
|
|
297
|
+
const ret = wasm.reactorclient_sendClientStats(this.__wbg_ptr, track_stats, connection_stat);
|
|
298
|
+
if (ret[1]) {
|
|
299
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
284
302
|
/**
|
|
285
303
|
* Send a command to the model and resolve with its reply.
|
|
286
304
|
*
|
|
@@ -533,6 +551,10 @@ function __wbg_get_imports() {
|
|
|
533
551
|
const ret = Object.assign(arg0, arg1);
|
|
534
552
|
return ret;
|
|
535
553
|
},
|
|
554
|
+
__wbg_bufferedAmount_88b36ead21acee6b: function(arg0) {
|
|
555
|
+
const ret = arg0.bufferedAmount;
|
|
556
|
+
return ret;
|
|
557
|
+
},
|
|
536
558
|
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
537
559
|
const ret = arg0.call(arg1);
|
|
538
560
|
return ret;
|
|
@@ -888,6 +910,10 @@ function __wbg_get_imports() {
|
|
|
888
910
|
__wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
|
|
889
911
|
queueMicrotask(arg0);
|
|
890
912
|
},
|
|
913
|
+
__wbg_readyState_26ebdcb846c7e00d: function(arg0) {
|
|
914
|
+
const ret = arg0.readyState;
|
|
915
|
+
return (__wbindgen_enum_RtcDataChannelState.indexOf(ret) + 1 || 5) - 1;
|
|
916
|
+
},
|
|
891
917
|
__wbg_replaceTrack_19163bddac4709c8: function(arg0, arg1) {
|
|
892
918
|
const ret = arg0.replaceTrack(arg1);
|
|
893
919
|
return ret;
|
|
@@ -960,6 +986,9 @@ function __wbg_get_imports() {
|
|
|
960
986
|
__wbg_set_body_029f2d171e0a005f: function(arg0, arg1) {
|
|
961
987
|
arg0.body = arg1;
|
|
962
988
|
},
|
|
989
|
+
__wbg_set_bufferedAmountLowThreshold_25a3158798d5b090: function(arg0, arg1) {
|
|
990
|
+
arg0.bufferedAmountLowThreshold = arg1 >>> 0;
|
|
991
|
+
},
|
|
963
992
|
__wbg_set_direction_1d775b49d9a3508b: function(arg0, arg1) {
|
|
964
993
|
arg0.direction = __wbindgen_enum_RtcRtpTransceiverDirection[arg1];
|
|
965
994
|
},
|
|
@@ -975,6 +1004,9 @@ function __wbg_get_imports() {
|
|
|
975
1004
|
__wbg_set_name_3bbc583faefa4193: function(arg0, arg1, arg2) {
|
|
976
1005
|
arg0.name = getStringFromWasm0(arg1, arg2);
|
|
977
1006
|
},
|
|
1007
|
+
__wbg_set_onbufferedamountlow_a240fd7da792556e: function(arg0, arg1) {
|
|
1008
|
+
arg0.onbufferedamountlow = arg1;
|
|
1009
|
+
},
|
|
978
1010
|
__wbg_set_onconnectionstatechange_993320a2febaef9b: function(arg0, arg1) {
|
|
979
1011
|
arg0.onconnectionstatechange = arg1;
|
|
980
1012
|
},
|
|
@@ -1055,27 +1087,27 @@ function __wbg_get_imports() {
|
|
|
1055
1087
|
console.warn(arg0);
|
|
1056
1088
|
},
|
|
1057
1089
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
1058
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
1090
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 307, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
1059
1091
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_85f920685b213f97___convert__closures_____invoke___wasm_bindgen_85f920685b213f97___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_85f920685b213f97___JsError___true_);
|
|
1060
1092
|
return ret;
|
|
1061
1093
|
},
|
|
1062
1094
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
1063
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx:
|
|
1095
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 217, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1064
1096
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_85f920685b213f97___convert__closures_____invoke___web_sys_9b25b1d5883c10fa___features__gen_MessageEvent__MessageEvent______true_);
|
|
1065
1097
|
return ret;
|
|
1066
1098
|
},
|
|
1067
1099
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
1068
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCPeerConnectionIceEvent")], shim_idx:
|
|
1100
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCPeerConnectionIceEvent")], shim_idx: 217, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1069
1101
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_85f920685b213f97___convert__closures_____invoke___web_sys_9b25b1d5883c10fa___features__gen_MessageEvent__MessageEvent______true__2);
|
|
1070
1102
|
return ret;
|
|
1071
1103
|
},
|
|
1072
1104
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
1073
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCTrackEvent")], shim_idx:
|
|
1105
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("RTCTrackEvent")], shim_idx: 217, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1074
1106
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_85f920685b213f97___convert__closures_____invoke___web_sys_9b25b1d5883c10fa___features__gen_MessageEvent__MessageEvent______true__3);
|
|
1075
1107
|
return ret;
|
|
1076
1108
|
},
|
|
1077
1109
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
1078
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx:
|
|
1110
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 221, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
1079
1111
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_85f920685b213f97___convert__closures_____invoke_______true_);
|
|
1080
1112
|
return ret;
|
|
1081
1113
|
},
|
|
@@ -1143,6 +1175,9 @@ function wasm_bindgen_85f920685b213f97___convert__closures_____invoke___js_sys_1
|
|
|
1143
1175
|
}
|
|
1144
1176
|
|
|
1145
1177
|
|
|
1178
|
+
const __wbindgen_enum_RtcDataChannelState = ["connecting", "open", "closing", "closed"];
|
|
1179
|
+
|
|
1180
|
+
|
|
1146
1181
|
const __wbindgen_enum_RtcDataChannelType = ["arraybuffer", "blob"];
|
|
1147
1182
|
|
|
1148
1183
|
|
|
Binary file
|
|
@@ -27,6 +27,7 @@ export const reactorclient_requestClip: (a: number, b: number) => any;
|
|
|
27
27
|
export const reactorclient_requestRecording: (a: number) => any;
|
|
28
28
|
export const reactorclient_requestSchema: (a: number) => any;
|
|
29
29
|
export const reactorclient_resumeTrack: (a: number, b: number, c: number) => any;
|
|
30
|
+
export const reactorclient_sendClientStats: (a: number, b: any, c: any) => [number, number];
|
|
30
31
|
export const reactorclient_sendCommand: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
31
32
|
export const reactorclient_sessionId: (a: number) => [number, number];
|
|
32
33
|
export const reactorclient_sessionInfo: (a: number) => [number, number, number];
|