@convai/web-sdk 1.0.0-beta.1 → 1.0.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/README.md +43 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js.map +1 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -293,6 +293,49 @@ convaiClient.videoControls.on("videoStateChange", (state) => {
|
|
|
293
293
|
});
|
|
294
294
|
```
|
|
295
295
|
|
|
296
|
+
### Lipsync (Facial Animation for 3D Characters)
|
|
297
|
+
|
|
298
|
+
Enable lipsync to receive blendshape data for animating 3D character faces in sync with speech:
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
const client = new ConvaiClient({
|
|
302
|
+
apiKey: "your-api-key",
|
|
303
|
+
characterId: "your-character-id",
|
|
304
|
+
enableLipsync: true,
|
|
305
|
+
blendshapeConfig: {
|
|
306
|
+
format: "arkit", // or "mha" for MetaHuman
|
|
307
|
+
},
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
await client.connect();
|
|
311
|
+
|
|
312
|
+
// In your 3D render loop (60 FPS)
|
|
313
|
+
let conversationStartTime = 0;
|
|
314
|
+
|
|
315
|
+
client.on("speakingChange", (speaking) => {
|
|
316
|
+
if (speaking) conversationStartTime = Date.now();
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
function render() {
|
|
320
|
+
const elapsedSeconds = (Date.now() - conversationStartTime) / 1000;
|
|
321
|
+
const result = client.blendshapeQueue.getFrameAtTime(elapsedSeconds);
|
|
322
|
+
|
|
323
|
+
if (result) {
|
|
324
|
+
// Apply blendshape values to your 3D character
|
|
325
|
+
myCharacter.morphTargets["jawOpen"] = result.frame[0];
|
|
326
|
+
myCharacter.morphTargets["mouthSmile"] = result.frame[1];
|
|
327
|
+
// ... apply remaining blendshapes
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
requestAnimationFrame(render);
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Blendshape Formats:**
|
|
335
|
+
|
|
336
|
+
- `arkit` - 61 blendshapes (iOS ARKit standard)
|
|
337
|
+
- `mha` - 251 blendshapes (MetaHuman)
|
|
338
|
+
|
|
296
339
|
### Interruption
|
|
297
340
|
|
|
298
341
|
Interrupt the character's current response to allow the user to speak immediately.
|
package/dist/core/index.d.ts
CHANGED
|
@@ -6,5 +6,6 @@ export { VideoManager } from './VideoManager';
|
|
|
6
6
|
export { ScreenShareManager } from './ScreenShareManager';
|
|
7
7
|
export { MessageHandler } from './MessageHandler';
|
|
8
8
|
export { BlendshapeQueue } from './BlendshapeQueue';
|
|
9
|
+
export type { TurnStats } from './BlendshapeQueue';
|
|
9
10
|
export { EventEmitter } from './EventEmitter';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,cAAc,SAAS,CAAC;AAGxB,YAAY,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGvE,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/dist/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,4CAA4C;AAC5C,cAAc,SAAS,CAAC;AAKxB,gCAAgC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,+BAA+B;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc;AACd,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,4CAA4C;AAC5C,cAAc,SAAS,CAAC;AAKxB,gCAAgC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,+BAA+B;AAC/B,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,qCAAqC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@convai/web-sdk",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Convai Web SDK for AI voice assistants. Supports both React and vanilla JavaScript/TypeScript. Build voice-powered AI interactions with real-time audio/video streaming.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -51,10 +51,14 @@
|
|
|
51
51
|
"example:react:build": "cd examples/react && pnpm build",
|
|
52
52
|
"example:vanilla": "cd examples/vanilla && pnpm dev",
|
|
53
53
|
"example:vanilla:build": "cd examples/vanilla && pnpm build",
|
|
54
|
+
"example:chatbot-testing": "cd examples/chatbot-testing && pnpm dev",
|
|
55
|
+
"example:chatbot-testing:build": "cd examples/chatbot-testing && pnpm build",
|
|
56
|
+
"example:lipsync-testing": "cd examples/lipsync-testing && pnpm dev",
|
|
57
|
+
"example:lipsync-testing:build": "cd examples/lipsync-testing && pnpm build",
|
|
54
58
|
"examples:dev": "pnpm example:react",
|
|
55
|
-
"examples:build": "pnpm example:react:build && pnpm example:vanilla:build",
|
|
56
|
-
"examples:install": "pnpm install && cd examples/react && pnpm install && cd ../vanilla && pnpm install",
|
|
57
|
-
"examples:clean": "pnpm clean && cd examples/react && pnpm clean && cd ../vanilla && pnpm clean"
|
|
59
|
+
"examples:build": "pnpm example:react:build && pnpm example:vanilla:build && pnpm example:chatbot-testing:build && pnpm example:lipsync-testing:build",
|
|
60
|
+
"examples:install": "pnpm install && cd examples/react && pnpm install && cd ../vanilla && pnpm install && cd ../chatbot-testing && pnpm install && cd ../lipsync-testing && pnpm install",
|
|
61
|
+
"examples:clean": "pnpm clean && cd examples/react && pnpm clean && cd ../vanilla && pnpm clean && cd ../chatbot-testing && pnpm clean && cd ../lipsync-testing && pnpm clean"
|
|
58
62
|
},
|
|
59
63
|
"keywords": [
|
|
60
64
|
"convai",
|