@nuancelabs/js-sdk 0.1.2 → 0.2.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.
Files changed (3) hide show
  1. package/index.d.ts +24 -4
  2. package/index.js +4 -2
  3. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -157,10 +157,10 @@ export declare type ConversationEvent =
157
157
  type: "avatar-ready";
158
158
  }
159
159
  /**
160
- * The avatar is presented as she should be seen: her video has reached its
161
- * full size and held it, or the wait for it ran out. Follows `avatar-ready`.
162
- * The session opens on it: her first words, and its recording. Reveal her
163
- * fully on this; between the two she is in view but not yet speaking.
160
+ * The avatar starts speaking: her first words, and the session's recording.
161
+ * Follows `avatar-ready`, at once by default. With `startOn: "full-quality"`
162
+ * it waits until her video has reached its full size and held it, or the
163
+ * wait ran out; in between she is in view but not yet speaking.
164
164
  */
165
165
  | {
166
166
  type: "avatar-presented";
@@ -296,6 +296,9 @@ export declare type ConversationStateValue = `${ConversationState}`;
296
296
  */
297
297
  export declare function createNuanceConversation(options?: CreateNuanceConversationOptions): Conversation;
298
298
 
299
+ /**
300
+ * Options for creating a Nuance conversation.
301
+ */
299
302
  export declare interface CreateNuanceConversationOptions {
300
303
  /**
301
304
  * Fetches a session token, for authenticating from a web page.
@@ -324,6 +327,20 @@ export declare interface CreateNuanceConversationOptions {
324
327
  videoCapture?: VideoCaptureConstraints;
325
328
  /** Local capture preferences, resolved once for each connection attempt. */
326
329
  mediaDevices?: MediaDevicePreferences | (() => MediaDevicePreferences);
330
+ /**
331
+ * When the avatar starts speaking.
332
+ *
333
+ * - `"first-frame"`: as soon as her first frame reaches the page.
334
+ * `avatar-presented` follows `avatar-ready` at once. Her video may be
335
+ * soft for its first few seconds while the connection ramps up.
336
+ * - `"full-quality"`: once her video has reached its full size and held
337
+ * it, or after at most about 12 seconds. She is in view but silent in
338
+ * between, so a page using this should cover her until
339
+ * `avatar-presented`.
340
+ *
341
+ * @defaultValue `"first-frame"`
342
+ */
343
+ startOn?: StartOn;
327
344
  }
328
345
 
329
346
 
@@ -412,6 +429,9 @@ export declare type SessionEndReason = "time-limit" | "ended" | "policy-violatio
412
429
 
413
430
 
414
431
 
432
+ /** When the avatar starts speaking: see {@link CreateNuanceConversationOptions.startOn}. */
433
+ export declare type StartOn = "first-frame" | "full-quality";
434
+
415
435
 
416
436
  /**
417
437
  * The local user participant in a conversation.
package/index.js CHANGED
@@ -4,7 +4,7 @@ function isRecord(value) {
4
4
  }
5
5
 
6
6
  // src/core/sdk-version.ts
7
- var SDK_HEADER = `js/${"0.1.2"}`;
7
+ var SDK_HEADER = `js/${"0.2.0"}`;
8
8
 
9
9
  // src/utils.ts
10
10
  function normalizeHost(host) {
@@ -2141,6 +2141,7 @@ class NuanceConversation {
2141
2141
  personality;
2142
2142
  variant;
2143
2143
  videoCapture;
2144
+ startOn;
2144
2145
  mediaDevices;
2145
2146
  resilientReconnect;
2146
2147
  delegate = null;
@@ -2176,6 +2177,7 @@ class NuanceConversation {
2176
2177
  this.personality = options.personality;
2177
2178
  this.variant = options.variant;
2178
2179
  this.videoCapture = options.videoCapture;
2180
+ this.startOn = options.startOn ?? "first-frame";
2179
2181
  this.mediaDevices = options.mediaDevices;
2180
2182
  this.resilientReconnect = options.resilientReconnect ?? false;
2181
2183
  }
@@ -2201,7 +2203,7 @@ class NuanceConversation {
2201
2203
  try {
2202
2204
  const request = {
2203
2205
  session_overrides: this.sessionOverrides,
2204
- client_ready: true
2206
+ client_ready: this.startOn === "full-quality"
2205
2207
  };
2206
2208
  const timezone = this.timezone();
2207
2209
  if (timezone)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuancelabs/js-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "JavaScript SDK for Nuance Labs conversation video AI avatar",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {