@streamoji/aitwin 0.5.1 → 0.5.3

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.d.ts CHANGED
@@ -6,6 +6,15 @@ export declare const AI_TWIN_THUMBNAIL_FILENAME = "thumbnail.webp";
6
6
 
7
7
  export declare const AiTwin: ForwardRefExoticComponent<AiTwinProps & RefAttributes<AiTwinHandle>>;
8
8
 
9
+ export declare type AiTwinCaptionsOptions = {
10
+ /** CSS font-family, e.g. "Inter, sans-serif" or "Georgia, serif". */
11
+ fontFamily?: string;
12
+ /** CSS font-size, e.g. "1rem" or "18px". Default: clamp for readability. */
13
+ fontSize?: string;
14
+ /** Text color. Default: rgba(255,255,255,0.85). */
15
+ color?: string;
16
+ };
17
+
9
18
  export declare type AiTwinHandle = {
10
19
  speakText: (text: string, options?: AvatarTtsSpeakOptions) => Promise<void>;
11
20
  stop: () => void;
@@ -16,8 +25,12 @@ export declare type AiTwinHandle = {
16
25
  * Suspends idle video until the next speak/stop clears preview mode.
17
26
  */
18
27
  setEmotion: (emotion: string) => void;
28
+ /** Hold a still mouth viseme preview (Oculus id, e.g. aa, PP, sil). */
29
+ setViseme: (viseme: string) => void;
19
30
  /** Active expression preview emotion, or null when not in preview mode. */
20
31
  getEmotion: () => string | null;
32
+ /** Active viseme preview id, or null when not in viseme preview mode. */
33
+ getViseme: () => string | null;
21
34
  /** Leave expression preview and return to normal idle. */
22
35
  clearEmotionPreview: () => void;
23
36
  isReady: () => boolean;
@@ -106,6 +119,8 @@ export declare type AiTwinProps = {
106
119
  * atlas handling. Omit to use the device limit.
107
120
  */
108
121
  pixiMaxTextureSize?: number;
122
+ /** Plain subtitles during TTS/voice playback. */
123
+ captions?: boolean | AiTwinCaptionsOptions;
109
124
  };
110
125
 
111
126
  export declare type AiTwinRecord = {
@@ -375,6 +390,11 @@ declare type SkippedVisemeEntry = {
375
390
  vtime: number;
376
391
  };
377
392
 
393
+ /** Round each viseme vtime to the nearest grid slot for playback spacing. */
394
+ export declare function snapVisemeQueueToGrid(queue: VisemeQueueItem[], gridMs?: number): VisemeQueueItem[];
395
+
396
+ export declare function snapVisemeVtimeToGrid(vtime: number, gridMs?: number): number;
397
+
378
398
  export declare const SPEAKING_RATE_MAX = 1.5;
379
399
 
380
400
  export declare const SPEAKING_RATE_MIN = 0.5;
@@ -410,6 +430,9 @@ export declare const VISEME_TEST_SPEAKING_RATE = 0.85;
410
430
  /** Viseme-test page: fixed female voice + speech speed for /avatar_ttsWithPoses. */
411
431
  export declare const VISEME_TEST_VOICE_ID = "Olivia";
412
432
 
433
+ /** Align viseme vtimes to this grid (matches transition frame tick). */
434
+ export declare const VISEME_VTIME_GRID_MS = 16;
435
+
413
436
  export declare interface VisemeQueueItem {
414
437
  viseme: string;
415
438
  weight: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamoji/aitwin",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "description": "Embeddable React AI twin face with TTS lipsync",
5
5
  "type": "module",
6
6
  "main": "./dist/aitwin.cjs",