@decartai/sdk 0.0.29 → 0.0.30
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.
|
@@ -67,8 +67,8 @@ var WebRTCConnection = class {
|
|
|
67
67
|
}
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
|
-
if (msg.type === "
|
|
71
|
-
this.websocketMessagesEmitter.emit("
|
|
70
|
+
if (msg.type === "set_image_ack") {
|
|
71
|
+
this.websocketMessagesEmitter.emit("setImageAck", msg);
|
|
72
72
|
return;
|
|
73
73
|
}
|
|
74
74
|
if (!this.pc) return;
|
|
@@ -134,16 +134,16 @@ var WebRTCConnection = class {
|
|
|
134
134
|
async setImageBase64(imageBase64) {
|
|
135
135
|
return new Promise((resolve, reject) => {
|
|
136
136
|
const timeoutId = setTimeout(() => {
|
|
137
|
-
this.websocketMessagesEmitter.off("
|
|
137
|
+
this.websocketMessagesEmitter.off("setImageAck", listener);
|
|
138
138
|
reject(/* @__PURE__ */ new Error("Image send timed out"));
|
|
139
139
|
}, AVATAR_SETUP_TIMEOUT_MS);
|
|
140
140
|
const listener = (msg) => {
|
|
141
141
|
clearTimeout(timeoutId);
|
|
142
|
-
this.websocketMessagesEmitter.off("
|
|
143
|
-
if (msg.
|
|
144
|
-
else reject(
|
|
142
|
+
this.websocketMessagesEmitter.off("setImageAck", listener);
|
|
143
|
+
if (msg.success) resolve();
|
|
144
|
+
else reject(new Error(msg.error ?? "Failed to send image"));
|
|
145
145
|
};
|
|
146
|
-
this.websocketMessagesEmitter.on("
|
|
146
|
+
this.websocketMessagesEmitter.on("setImageAck", listener);
|
|
147
147
|
this.send({
|
|
148
148
|
type: "set_image",
|
|
149
149
|
image_data: imageBase64
|