@convai/web-sdk 0.3.1-beta.3 → 0.3.2-beta.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 +535 -1077
- package/dist/core/AudioManager.d.ts.map +1 -0
- package/dist/core/AudioManager.js +262 -0
- package/dist/core/AudioManager.js.map +1 -0
- package/dist/core/BlendshapeQueue.d.ts +128 -0
- package/dist/core/BlendshapeQueue.d.ts.map +1 -0
- package/dist/core/BlendshapeQueue.js +229 -0
- package/dist/core/BlendshapeQueue.js.map +1 -0
- package/dist/{types/core → core}/ConvaiClient.d.ts +19 -15
- package/dist/core/ConvaiClient.d.ts.map +1 -0
- package/dist/core/ConvaiClient.js +623 -0
- package/dist/core/ConvaiClient.js.map +1 -0
- package/dist/core/EventEmitter.d.ts.map +1 -0
- package/dist/core/EventEmitter.js +68 -0
- package/dist/core/EventEmitter.js.map +1 -0
- package/dist/{types/core → core}/MessageHandler.d.ts +7 -0
- package/dist/core/MessageHandler.d.ts.map +1 -0
- package/dist/core/MessageHandler.js +333 -0
- package/dist/core/MessageHandler.js.map +1 -0
- package/dist/core/ScreenShareManager.d.ts.map +1 -0
- package/dist/core/ScreenShareManager.js +207 -0
- package/dist/core/ScreenShareManager.js.map +1 -0
- package/dist/core/VideoManager.d.ts.map +1 -0
- package/dist/core/VideoManager.js +205 -0
- package/dist/core/VideoManager.js.map +1 -0
- package/dist/{types/core → core}/index.d.ts +2 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +14 -1970
- package/dist/core/index.js.map +1 -0
- package/dist/{types/core → core}/types.d.ts +12 -21
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/dev.d.ts +12 -0
- package/dist/dev.d.ts.map +1 -0
- package/dist/dev.js +12 -0
- package/dist/dev.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.d.ts.map +1 -0
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.js +201 -0
- package/dist/lipsync-helpers/arkitBlendshapeHelpers.js.map +1 -0
- package/dist/lipsync-helpers/arkitOrder61.d.ts.map +1 -0
- package/dist/lipsync-helpers/arkitOrder61.js +287 -0
- package/dist/lipsync-helpers/arkitOrder61.js.map +1 -0
- package/dist/lipsync-helpers/arkitPhonemeReference.d.ts.map +1 -0
- package/dist/lipsync-helpers/arkitPhonemeReference.js +362 -0
- package/dist/lipsync-helpers/arkitPhonemeReference.js.map +1 -0
- package/dist/{types/lipsync-helpers → lipsync-helpers}/index.d.ts +1 -0
- package/dist/lipsync-helpers/index.d.ts.map +1 -0
- package/dist/lipsync-helpers/index.js +20 -1165
- package/dist/lipsync-helpers/index.js.map +1 -0
- package/dist/lipsync-helpers/metahumanOrder251.d.ts +115 -0
- package/dist/lipsync-helpers/metahumanOrder251.d.ts.map +1 -0
- package/dist/lipsync-helpers/metahumanOrder251.js +432 -0
- package/dist/lipsync-helpers/metahumanOrder251.js.map +1 -0
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.d.ts.map +1 -0
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.js +315 -0
- package/dist/lipsync-helpers/neurosyncBlendshapeMapper.js.map +1 -0
- package/dist/react/components/ConvaiWidget.d.ts +68 -0
- package/dist/react/components/ConvaiWidget.d.ts.map +1 -0
- package/dist/react/components/ConvaiWidget.js +505 -0
- package/dist/react/components/ConvaiWidget.js.map +1 -0
- package/dist/react/components/index.d.ts +2 -0
- package/dist/react/components/index.d.ts.map +1 -0
- package/dist/react/components/index.js +3 -0
- package/dist/react/components/index.js.map +1 -0
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts +10 -0
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js +316 -0
- package/dist/react/components/rtc-widget/components/AudioSettingsPanel.js.map +1 -0
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts +36 -0
- package/dist/react/components/rtc-widget/components/AudioVisualizer.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js +259 -0
- package/dist/react/components/rtc-widget/components/AudioVisualizer.js.map +1 -0
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts +10 -0
- package/dist/react/components/rtc-widget/components/ConviMessage.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/ConviMessage.js +14 -0
- package/dist/react/components/rtc-widget/components/ConviMessage.js.map +1 -0
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts +9 -0
- package/dist/react/components/rtc-widget/components/FloatingVideo.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/FloatingVideo.js +122 -0
- package/dist/react/components/rtc-widget/components/FloatingVideo.js.map +1 -0
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts +7 -0
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js +68 -0
- package/dist/react/components/rtc-widget/components/MarkdownRenderer.js.map +1 -0
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts +10 -0
- package/dist/react/components/rtc-widget/components/MessageBubble.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/MessageBubble.js +23 -0
- package/dist/react/components/rtc-widget/components/MessageBubble.js.map +1 -0
- package/dist/react/components/rtc-widget/components/MessageList.d.ts +11 -0
- package/dist/react/components/rtc-widget/components/MessageList.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/MessageList.js +89 -0
- package/dist/react/components/rtc-widget/components/MessageList.js.map +1 -0
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts +9 -0
- package/dist/react/components/rtc-widget/components/UserMessage.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/UserMessage.js +15 -0
- package/dist/react/components/rtc-widget/components/UserMessage.js.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts +6 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js +15 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviButton.js.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts +25 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js +172 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviFooter.js.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts +17 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js +66 -0
- package/dist/react/components/rtc-widget/components/conviComponents/ConviHeader.js.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts +12 -0
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js +68 -0
- package/dist/react/components/rtc-widget/components/conviComponents/SettingsTray.js.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts +12 -0
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js +255 -0
- package/dist/react/components/rtc-widget/components/conviComponents/VoiceModeOverlay.js.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts +6 -0
- package/dist/react/components/rtc-widget/components/conviComponents/index.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/conviComponents/index.js +6 -0
- package/dist/react/components/rtc-widget/components/conviComponents/index.js.map +1 -0
- package/dist/react/components/rtc-widget/components/index.d.ts +9 -0
- package/dist/react/components/rtc-widget/components/index.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/components/index.js +15 -0
- package/dist/react/components/rtc-widget/components/index.js.map +1 -0
- package/dist/react/components/rtc-widget/index.d.ts +6 -0
- package/dist/react/components/rtc-widget/index.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/index.js +9 -0
- package/dist/react/components/rtc-widget/index.js.map +1 -0
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts +116 -0
- package/dist/react/components/rtc-widget/styles/framerConfig.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/styles/framerConfig.js +73 -0
- package/dist/react/components/rtc-widget/styles/framerConfig.js.map +1 -0
- package/dist/react/components/rtc-widget/styles/icons.d.ts +28 -0
- package/dist/react/components/rtc-widget/styles/icons.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/styles/icons.js +257 -0
- package/dist/react/components/rtc-widget/styles/icons.js.map +1 -0
- package/dist/react/components/rtc-widget/styles/index.d.ts +6 -0
- package/dist/react/components/rtc-widget/styles/index.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/styles/index.js +9 -0
- package/dist/react/components/rtc-widget/styles/index.js.map +1 -0
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts +90 -0
- package/dist/react/components/rtc-widget/styles/styledComponents.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/styles/styledComponents.js +663 -0
- package/dist/react/components/rtc-widget/styles/styledComponents.js.map +1 -0
- package/dist/react/components/rtc-widget/styles/theme.d.ts +188 -0
- package/dist/react/components/rtc-widget/styles/theme.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/styles/theme.js +290 -0
- package/dist/react/components/rtc-widget/styles/theme.js.map +1 -0
- package/dist/react/components/rtc-widget/types/index.d.ts +60 -0
- package/dist/react/components/rtc-widget/types/index.d.ts.map +1 -0
- package/dist/react/components/rtc-widget/types/index.js +2 -0
- package/dist/react/components/rtc-widget/types/index.js.map +1 -0
- package/dist/react/hooks/index.d.ts +4 -0
- package/dist/react/hooks/index.d.ts.map +1 -0
- package/dist/react/hooks/index.js +6 -0
- package/dist/react/hooks/index.js.map +1 -0
- package/dist/react/hooks/useCharacterInfo.d.ts +17 -0
- package/dist/react/hooks/useCharacterInfo.d.ts.map +1 -0
- package/dist/react/hooks/useCharacterInfo.js +60 -0
- package/dist/react/hooks/useCharacterInfo.js.map +1 -0
- package/dist/react/hooks/useConvaiClient.d.ts +35 -0
- package/dist/react/hooks/useConvaiClient.d.ts.map +1 -0
- package/dist/react/hooks/useConvaiClient.js +183 -0
- package/dist/react/hooks/useConvaiClient.js.map +1 -0
- package/dist/react/hooks/useLocalCameraTrack.d.ts +22 -0
- package/dist/react/hooks/useLocalCameraTrack.d.ts.map +1 -0
- package/dist/react/hooks/useLocalCameraTrack.js +34 -0
- package/dist/react/hooks/useLocalCameraTrack.js.map +1 -0
- package/dist/react/index.d.ts +7 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +13 -0
- package/dist/react/index.js.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/LatencyMonitor.d.ts.map +1 -0
- package/dist/utils/LatencyMonitor.js +136 -0
- package/dist/utils/LatencyMonitor.js.map +1 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +96 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/speakerManagement.d.ts.map +1 -0
- package/dist/utils/speakerManagement.js +64 -0
- package/dist/utils/speakerManagement.js.map +1 -0
- package/dist/{types/vanilla → vanilla}/AudioRenderer.d.ts +5 -0
- package/dist/vanilla/AudioRenderer.d.ts.map +1 -0
- package/dist/vanilla/AudioRenderer.js +135 -0
- package/dist/vanilla/AudioRenderer.js.map +1 -0
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -0
- package/dist/vanilla/ConvaiWidget.js +1786 -0
- package/dist/vanilla/ConvaiWidget.js.map +1 -0
- package/dist/vanilla/icons.d.ts.map +1 -0
- package/dist/vanilla/icons.js +222 -0
- package/dist/vanilla/icons.js.map +1 -0
- package/dist/{types/vanilla → vanilla}/index.d.ts +1 -3
- package/dist/vanilla/index.d.ts.map +1 -0
- package/dist/vanilla/index.js +20 -5509
- package/dist/vanilla/index.js.map +1 -0
- package/dist/vanilla/styles.d.ts.map +1 -0
- package/dist/vanilla/styles.js +287 -0
- package/dist/vanilla/styles.js.map +1 -0
- package/dist/vanilla/types.d.ts +43 -0
- package/dist/vanilla/types.d.ts.map +1 -0
- package/dist/vanilla/types.js +2 -0
- package/dist/vanilla/types.js.map +1 -0
- package/package.json +33 -38
- package/CHANGELOG.md +0 -165
- package/dist/core/index.cjs +0 -1977
- package/dist/lipsync-helpers/index.cjs +0 -1195
- package/dist/types/core/AudioManager.d.ts.map +0 -1
- package/dist/types/core/ConvaiClient.d.ts.map +0 -1
- package/dist/types/core/EventEmitter.d.ts.map +0 -1
- package/dist/types/core/MessageHandler.d.ts.map +0 -1
- package/dist/types/core/ScreenShareManager.d.ts.map +0 -1
- package/dist/types/core/VideoManager.d.ts.map +0 -1
- package/dist/types/core/index.d.ts.map +0 -1
- package/dist/types/core/types.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/arkitBlendshapeHelpers.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/arkitOrder61.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/arkitPhonemeReference.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/index.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/neurosyncBlendshapeMapper.d.ts.map +0 -1
- package/dist/types/types/index.d.ts.map +0 -1
- package/dist/types/utils/LatencyMonitor.d.ts.map +0 -1
- package/dist/types/utils/logger.d.ts.map +0 -1
- package/dist/types/utils/speakerManagement.d.ts.map +0 -1
- package/dist/types/vanilla/AudioRenderer.d.ts.map +0 -1
- package/dist/types/vanilla/ConvaiWidget.d.ts.map +0 -1
- package/dist/types/vanilla/icons.d.ts.map +0 -1
- package/dist/types/vanilla/index.d.ts.map +0 -1
- package/dist/types/vanilla/styles.d.ts.map +0 -1
- package/dist/types/vanilla/types.d.ts +0 -106
- package/dist/types/vanilla/types.d.ts.map +0 -1
- package/dist/umd/convai.umd.js +0 -1
- package/dist/vanilla/index.cjs +0 -5559
- /package/dist/{types/core → core}/AudioManager.d.ts +0 -0
- /package/dist/{types/core → core}/EventEmitter.d.ts +0 -0
- /package/dist/{types/core → core}/ScreenShareManager.d.ts +0 -0
- /package/dist/{types/core → core}/VideoManager.d.ts +0 -0
- /package/dist/{types/lipsync-helpers → lipsync-helpers}/arkitBlendshapeHelpers.d.ts +0 -0
- /package/dist/{types/lipsync-helpers → lipsync-helpers}/arkitOrder61.d.ts +0 -0
- /package/dist/{types/lipsync-helpers → lipsync-helpers}/arkitPhonemeReference.d.ts +0 -0
- /package/dist/{types/lipsync-helpers → lipsync-helpers}/neurosyncBlendshapeMapper.d.ts +0 -0
- /package/dist/types/{types/index.d.ts → index.d.ts} +0 -0
- /package/dist/{types/utils → utils}/LatencyMonitor.d.ts +0 -0
- /package/dist/{types/utils → utils}/logger.d.ts +0 -0
- /package/dist/{types/utils → utils}/speakerManagement.d.ts +0 -0
- /package/dist/{types/vanilla → vanilla}/ConvaiWidget.d.ts +0 -0
- /package/dist/{types/vanilla → vanilla}/icons.d.ts +0 -0
- /package/dist/{types/vanilla → vanilla}/styles.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioManager.d.ts","sourceRoot":"","sources":["../../src/core/AudioManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,YAAa,YAAW,aAAa;IACrE,OAAO,CAAC,IAAI,CAAqB;IACjC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,aAAa,CAAkB;IACvC,OAAO,CAAC,WAAW,CAAa;gBAEpB,IAAI,CAAC,EAAE,IAAI;IAOvB,IAAI,cAAc,IAAI,OAAO,CAE5B;IAED,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI;IAczB;;OAEG;IACH,OAAO,CAAC,cAAc;IA2CtB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAKxB;;;;OAIG;IACH,iBAAiB,CAAC,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAO,GAAG,IAAI;IA0CzD;;OAEG;IACH,OAAO,CAAC,WAAW;IAInB;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBlC;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCnC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC;IAIhC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAIlC;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,IAAI,CAAC;IAQlC;;OAEG;IACG,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYrD;;OAEG;IACG,eAAe,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAUnD;;OAEG;IACH,yBAAyB,IAAI,IAAI;IAOjC;;OAEG;IACH,wBAAwB,IAAI,IAAI;IAIhC;;OAEG;IACH,KAAK,IAAI,IAAI;CAUd"}
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { EventEmitter } from "./EventEmitter";
|
|
2
|
+
/**
|
|
3
|
+
* Manages audio controls for LiveKit room
|
|
4
|
+
* Provides methods to enable/disable microphone, manage audio devices,
|
|
5
|
+
* and control audio state.
|
|
6
|
+
*/
|
|
7
|
+
export class AudioManager extends EventEmitter {
|
|
8
|
+
constructor(room) {
|
|
9
|
+
super();
|
|
10
|
+
this.room = null;
|
|
11
|
+
this._isAudioEnabled = false;
|
|
12
|
+
this._isAudioMuted = false;
|
|
13
|
+
this._audioLevel = 0;
|
|
14
|
+
if (room) {
|
|
15
|
+
this.setRoom(room);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
get isAudioEnabled() {
|
|
19
|
+
return this._isAudioEnabled;
|
|
20
|
+
}
|
|
21
|
+
get isAudioMuted() {
|
|
22
|
+
return this._isAudioMuted;
|
|
23
|
+
}
|
|
24
|
+
get audioLevel() {
|
|
25
|
+
return this._audioLevel;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Set the LiveKit room instance
|
|
29
|
+
*/
|
|
30
|
+
setRoom(room) {
|
|
31
|
+
// Clean up previous room listeners
|
|
32
|
+
if (this.room) {
|
|
33
|
+
this.cleanupListeners();
|
|
34
|
+
}
|
|
35
|
+
this.room = room;
|
|
36
|
+
if (room && room.state !== 'disconnected') {
|
|
37
|
+
this.setupListeners();
|
|
38
|
+
this.updateState();
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Setup event listeners for room
|
|
43
|
+
*/
|
|
44
|
+
setupListeners() {
|
|
45
|
+
if (!this.room)
|
|
46
|
+
return;
|
|
47
|
+
const localParticipant = this.room.localParticipant;
|
|
48
|
+
const handleTrackMuted = (track) => {
|
|
49
|
+
if (track.source === 'microphone') {
|
|
50
|
+
this._isAudioMuted = true;
|
|
51
|
+
this._isAudioEnabled = false;
|
|
52
|
+
this.emit('audioStateChange', { isAudioMuted: true, isAudioEnabled: false });
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const handleTrackUnmuted = (track) => {
|
|
56
|
+
if (track.source === 'microphone') {
|
|
57
|
+
this._isAudioMuted = false;
|
|
58
|
+
this._isAudioEnabled = true;
|
|
59
|
+
this.emit('audioStateChange', { isAudioMuted: false, isAudioEnabled: true });
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const handleTrackPublished = (track) => {
|
|
63
|
+
if (track.source === 'microphone') {
|
|
64
|
+
this._isAudioEnabled = true;
|
|
65
|
+
this._isAudioMuted = false;
|
|
66
|
+
this.emit('audioStateChange', { isAudioMuted: false, isAudioEnabled: true });
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const handleTrackUnpublished = (track) => {
|
|
70
|
+
if (track.source === 'microphone') {
|
|
71
|
+
this._isAudioEnabled = false;
|
|
72
|
+
this._isAudioMuted = true;
|
|
73
|
+
this.emit('audioStateChange', { isAudioMuted: true, isAudioEnabled: false });
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
localParticipant.on('trackMuted', handleTrackMuted);
|
|
77
|
+
localParticipant.on('trackUnmuted', handleTrackUnmuted);
|
|
78
|
+
localParticipant.on('trackPublished', handleTrackPublished);
|
|
79
|
+
localParticipant.on('trackUnpublished', handleTrackUnpublished);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Clean up event listeners
|
|
83
|
+
*/
|
|
84
|
+
cleanupListeners() {
|
|
85
|
+
if (!this.room)
|
|
86
|
+
return;
|
|
87
|
+
// LiveKit handles cleanup automatically when participant is removed
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Force-sync the stored audio state with the underlying LiveKit room.
|
|
91
|
+
* Useful right after a connection completes so the UI can reflect
|
|
92
|
+
* the current microphone permission without waiting for a toggle event.
|
|
93
|
+
*/
|
|
94
|
+
syncStateFromRoom(options = {}) {
|
|
95
|
+
const { emit = false } = options;
|
|
96
|
+
if (!this.room || this.room.state === 'disconnected') {
|
|
97
|
+
const stateChanged = this._isAudioEnabled !== false ||
|
|
98
|
+
this._isAudioMuted !== true ||
|
|
99
|
+
this._audioLevel !== 0;
|
|
100
|
+
this._isAudioEnabled = false;
|
|
101
|
+
this._isAudioMuted = true;
|
|
102
|
+
this._audioLevel = 0;
|
|
103
|
+
if (emit && stateChanged) {
|
|
104
|
+
this.emit('audioStateChange', {
|
|
105
|
+
isAudioMuted: this._isAudioMuted,
|
|
106
|
+
isAudioEnabled: this._isAudioEnabled,
|
|
107
|
+
audioLevel: this._audioLevel,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const localParticipant = this.room.localParticipant;
|
|
113
|
+
const isMicEnabled = localParticipant?.isMicrophoneEnabled ?? false;
|
|
114
|
+
const nextMutedState = !isMicEnabled;
|
|
115
|
+
const stateChanged = this._isAudioEnabled !== isMicEnabled ||
|
|
116
|
+
this._isAudioMuted !== nextMutedState;
|
|
117
|
+
this._isAudioEnabled = isMicEnabled;
|
|
118
|
+
this._isAudioMuted = nextMutedState;
|
|
119
|
+
if (emit && stateChanged) {
|
|
120
|
+
this.emit('audioStateChange', {
|
|
121
|
+
isAudioMuted: this._isAudioMuted,
|
|
122
|
+
isAudioEnabled: this._isAudioEnabled,
|
|
123
|
+
audioLevel: this._audioLevel,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Update audio state from room
|
|
129
|
+
*/
|
|
130
|
+
updateState() {
|
|
131
|
+
this.syncStateFromRoom();
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Enable audio
|
|
135
|
+
*/
|
|
136
|
+
async enableAudio() {
|
|
137
|
+
if (!this.room) {
|
|
138
|
+
throw new Error('Room not initialized');
|
|
139
|
+
}
|
|
140
|
+
try {
|
|
141
|
+
await this.room.localParticipant.setMicrophoneEnabled(true);
|
|
142
|
+
this._isAudioEnabled = true;
|
|
143
|
+
this._isAudioMuted = false;
|
|
144
|
+
this.emit('audioStateChange', {
|
|
145
|
+
isAudioMuted: false,
|
|
146
|
+
isAudioEnabled: true,
|
|
147
|
+
audioLevel: this._audioLevel,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
catch (error) {
|
|
151
|
+
throw error;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Disable audio and completely release microphone
|
|
156
|
+
*/
|
|
157
|
+
async disableAudio() {
|
|
158
|
+
if (!this.room) {
|
|
159
|
+
throw new Error('Room not initialized');
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
// Get the microphone track before disabling
|
|
163
|
+
const micTrack = Array.from(this.room.localParticipant.audioTrackPublications.values()).find((publication) => publication.source === 'microphone' && publication.track)?.track;
|
|
164
|
+
// Disable microphone (unpublishes the track)
|
|
165
|
+
await this.room.localParticipant.setMicrophoneEnabled(false);
|
|
166
|
+
// Explicitly stop the underlying MediaStreamTrack to release hardware
|
|
167
|
+
// This removes the browser recording indicator
|
|
168
|
+
if (micTrack) {
|
|
169
|
+
micTrack.stop();
|
|
170
|
+
}
|
|
171
|
+
this._isAudioEnabled = false;
|
|
172
|
+
this._isAudioMuted = true;
|
|
173
|
+
this.emit('audioStateChange', {
|
|
174
|
+
isAudioMuted: true,
|
|
175
|
+
isAudioEnabled: false,
|
|
176
|
+
audioLevel: 0,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch (error) {
|
|
180
|
+
throw error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Mute audio
|
|
185
|
+
*/
|
|
186
|
+
async muteAudio() {
|
|
187
|
+
await this.disableAudio();
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Unmute audio
|
|
191
|
+
*/
|
|
192
|
+
async unmuteAudio() {
|
|
193
|
+
await this.enableAudio();
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* Toggle audio
|
|
197
|
+
*/
|
|
198
|
+
async toggleAudio() {
|
|
199
|
+
if (this._isAudioMuted) {
|
|
200
|
+
await this.unmuteAudio();
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
await this.muteAudio();
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Set audio device
|
|
208
|
+
*/
|
|
209
|
+
async setAudioDevice(deviceId) {
|
|
210
|
+
if (!this.room) {
|
|
211
|
+
throw new Error('Room not initialized');
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
await this.room.localParticipant.setMicrophoneEnabled(true, { deviceId });
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
throw error;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get available audio devices
|
|
222
|
+
*/
|
|
223
|
+
async getAudioDevices() {
|
|
224
|
+
try {
|
|
225
|
+
const devices = await navigator.mediaDevices.enumerateDevices();
|
|
226
|
+
const audioDevices = devices.filter(device => device.kind === 'audioinput');
|
|
227
|
+
return audioDevices;
|
|
228
|
+
}
|
|
229
|
+
catch (error) {
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Start audio level monitoring
|
|
235
|
+
*/
|
|
236
|
+
startAudioLevelMonitoring() {
|
|
237
|
+
if (!this.room) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
// TODO: Implement audio level monitoring when LiveKit provides the API
|
|
241
|
+
}
|
|
242
|
+
/**
|
|
243
|
+
* Stop audio level monitoring
|
|
244
|
+
*/
|
|
245
|
+
stopAudioLevelMonitoring() {
|
|
246
|
+
this._audioLevel = 0;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Reset state on disconnect
|
|
250
|
+
*/
|
|
251
|
+
reset() {
|
|
252
|
+
this._isAudioEnabled = false;
|
|
253
|
+
this._isAudioMuted = false;
|
|
254
|
+
this._audioLevel = 0;
|
|
255
|
+
this.emit('audioStateChange', {
|
|
256
|
+
isAudioMuted: false,
|
|
257
|
+
isAudioEnabled: false,
|
|
258
|
+
audioLevel: 0
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
//# sourceMappingURL=AudioManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AudioManager.js","sourceRoot":"","sources":["../../src/core/AudioManager.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C;;;;GAIG;AACH,MAAM,OAAO,YAAa,SAAQ,YAAY;IAM5C,YAAY,IAAW;QACrB,KAAK,EAAE,CAAC;QANF,SAAI,GAAgB,IAAI,CAAC;QACzB,oBAAe,GAAY,KAAK,CAAC;QACjC,kBAAa,GAAY,KAAK,CAAC;QAC/B,gBAAW,GAAW,CAAC,CAAC;QAI9B,IAAI,IAAI,EAAE,CAAC;YACT,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAI,YAAY;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAU;QAChB,mCAAmC;QACnC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC1B,CAAC;QAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QAEjB,IAAI,IAAI,IAAI,IAAI,CAAC,KAAK,KAAK,cAAc,EAAE,CAAC;YAC1C,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,CAAC;IACH,CAAC;IAED;;OAEG;IACK,cAAc;QACpB,IAAI,CAAC,IAAI,CAAC,IAAI;YAAE,OAAO;QAEvB,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;QAEpD,MAAM,gBAAgB,GAAG,CAAC,KAAU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E,CAAC;SACd,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-processor function that can modify blendshape frames
|
|
3
|
+
* @param frame - The blendshape frame to process
|
|
4
|
+
* @param frameIndex - Index of the frame in the sequence
|
|
5
|
+
* @param totalFrames - Total number of frames in the sequence
|
|
6
|
+
* @returns Modified frame
|
|
7
|
+
*/
|
|
8
|
+
export type BlendshapePostProcessor = (frame: Float32Array, frameIndex: number, totalFrames: number) => Float32Array;
|
|
9
|
+
/**
|
|
10
|
+
* BlendshapeQueue - Manages buffering and lifecycle of blendshape frames
|
|
11
|
+
*
|
|
12
|
+
* This queue buffers blendshape chunks (typically 10 frames each) as they arrive from the server,
|
|
13
|
+
* before the bot starts speaking. Playback begins when bot-started-speaking is triggered.
|
|
14
|
+
*
|
|
15
|
+
* Flow:
|
|
16
|
+
* 1. Blendshapes arrive in chunks and are buffered in the queue
|
|
17
|
+
* 2. bot-started-speaking triggers conversation start
|
|
18
|
+
* 3. Consumer reads frames from queue using time-based indexing (elapsed_time * 60fps)
|
|
19
|
+
* 4. blendshape-turn-stats marks conversation end
|
|
20
|
+
* 5. Queue drains remaining frames and resets for next conversation
|
|
21
|
+
*
|
|
22
|
+
* Features:
|
|
23
|
+
* - Zero frame blending for smooth transitions (always enabled)
|
|
24
|
+
* - Frame interpolation for smooth animation (always enabled)
|
|
25
|
+
* - Post-processing hooks for custom frame modifications
|
|
26
|
+
*/
|
|
27
|
+
export declare class BlendshapeQueue {
|
|
28
|
+
private queue;
|
|
29
|
+
private conversationActive;
|
|
30
|
+
private conversationEnded;
|
|
31
|
+
private postProcessors;
|
|
32
|
+
private static readonly ZERO_FRAME;
|
|
33
|
+
private static readonly TARGET_FPS;
|
|
34
|
+
/**
|
|
35
|
+
* Add a chunk of blendshapes to the queue
|
|
36
|
+
* @param blendshapes - Array of blendshape frames (each frame is an array of numbers)
|
|
37
|
+
*/
|
|
38
|
+
addChunk(blendshapes: number[][]): void;
|
|
39
|
+
/**
|
|
40
|
+
* Get all frames currently in the queue
|
|
41
|
+
* @returns Array of blendshape frames as Float32Arrays
|
|
42
|
+
*/
|
|
43
|
+
getFrames(): Float32Array[];
|
|
44
|
+
/**
|
|
45
|
+
* Get a specific frame by index
|
|
46
|
+
* @param index - Frame index
|
|
47
|
+
* @returns The frame at the given index, or null if out of bounds
|
|
48
|
+
*/
|
|
49
|
+
getFrame(index: number): Float32Array | null;
|
|
50
|
+
/**
|
|
51
|
+
* Remove frames from the beginning of the queue (consume frames)
|
|
52
|
+
* @param count - Number of frames to remove
|
|
53
|
+
*/
|
|
54
|
+
consumeFrames(count: number): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get the number of frames currently in the queue
|
|
57
|
+
*/
|
|
58
|
+
get length(): number;
|
|
59
|
+
/**
|
|
60
|
+
* Check if queue has frames
|
|
61
|
+
*/
|
|
62
|
+
hasFrames(): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Check if conversation is active
|
|
65
|
+
*/
|
|
66
|
+
isConversationActive(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Check if conversation has ended (blendshape-turn-stats received)
|
|
69
|
+
*/
|
|
70
|
+
isConversationEnded(): boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Mark conversation start (called when bot-started-speaking)
|
|
73
|
+
*/
|
|
74
|
+
startConversation(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Mark conversation end (called when blendshape-turn-stats received)
|
|
77
|
+
* Queue should be drained after this point
|
|
78
|
+
*/
|
|
79
|
+
endConversation(): void;
|
|
80
|
+
/**
|
|
81
|
+
* Reset queue for new conversation
|
|
82
|
+
* Should be called after all frames have been consumed
|
|
83
|
+
*/
|
|
84
|
+
reset(): void;
|
|
85
|
+
/**
|
|
86
|
+
* Add a post-processor to modify frames during playback
|
|
87
|
+
*/
|
|
88
|
+
addPostProcessor(processor: BlendshapePostProcessor): void;
|
|
89
|
+
/**
|
|
90
|
+
* Remove a post-processor
|
|
91
|
+
*/
|
|
92
|
+
removePostProcessor(processor: BlendshapePostProcessor): void;
|
|
93
|
+
/**
|
|
94
|
+
* Clear all post-processors
|
|
95
|
+
*/
|
|
96
|
+
clearPostProcessors(): void;
|
|
97
|
+
/**
|
|
98
|
+
* Apply all post-processors to a frame
|
|
99
|
+
*/
|
|
100
|
+
private applyPostProcessing;
|
|
101
|
+
/**
|
|
102
|
+
* Get interpolated frame with zero-frame blending (always enabled)
|
|
103
|
+
* @param elapsedTime - Elapsed time in seconds
|
|
104
|
+
* @returns Interpolated frame with blending info
|
|
105
|
+
*/
|
|
106
|
+
getInterpolatedFrame(elapsedTime: number): {
|
|
107
|
+
frame: Float32Array;
|
|
108
|
+
frameIndex: number;
|
|
109
|
+
isBlendingToZero: boolean;
|
|
110
|
+
} | null;
|
|
111
|
+
/**
|
|
112
|
+
* Interpolate between two frames
|
|
113
|
+
*/
|
|
114
|
+
private interpolate;
|
|
115
|
+
/**
|
|
116
|
+
* Get the zero frame (neutral pose)
|
|
117
|
+
*/
|
|
118
|
+
static getZeroFrame(): Float32Array;
|
|
119
|
+
/**
|
|
120
|
+
* Get debug info about the queue state
|
|
121
|
+
*/
|
|
122
|
+
getDebugInfo(): {
|
|
123
|
+
frameCount: number;
|
|
124
|
+
conversationActive: boolean;
|
|
125
|
+
conversationEnded: boolean;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=BlendshapeQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlendshapeQueue.d.ts","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG,CACpC,KAAK,EAAE,YAAY,EACnB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,KAChB,YAAY,CAAC;AAElB;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,eAAe;IAC1B,OAAO,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AAI,YAAY;IAInC;;OAEG;IACH,YAAY,IAAI;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,EAAE,OAAO,CAAC;KAC5B;CAOF"}
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* BlendshapeQueue - Manages buffering and lifecycle of blendshape frames
|
|
3
|
+
*
|
|
4
|
+
* This queue buffers blendshape chunks (typically 10 frames each) as they arrive from the server,
|
|
5
|
+
* before the bot starts speaking. Playback begins when bot-started-speaking is triggered.
|
|
6
|
+
*
|
|
7
|
+
* Flow:
|
|
8
|
+
* 1. Blendshapes arrive in chunks and are buffered in the queue
|
|
9
|
+
* 2. bot-started-speaking triggers conversation start
|
|
10
|
+
* 3. Consumer reads frames from queue using time-based indexing (elapsed_time * 60fps)
|
|
11
|
+
* 4. blendshape-turn-stats marks conversation end
|
|
12
|
+
* 5. Queue drains remaining frames and resets for next conversation
|
|
13
|
+
*
|
|
14
|
+
* Features:
|
|
15
|
+
* - Zero frame blending for smooth transitions (always enabled)
|
|
16
|
+
* - Frame interpolation for smooth animation (always enabled)
|
|
17
|
+
* - Post-processing hooks for custom frame modifications
|
|
18
|
+
*/
|
|
19
|
+
export class BlendshapeQueue {
|
|
20
|
+
constructor() {
|
|
21
|
+
this.queue = [];
|
|
22
|
+
this.conversationActive = false;
|
|
23
|
+
this.conversationEnded = false;
|
|
24
|
+
// Post-processing
|
|
25
|
+
this.postProcessors = [];
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Add a chunk of blendshapes to the queue
|
|
29
|
+
* @param blendshapes - Array of blendshape frames (each frame is an array of numbers)
|
|
30
|
+
*/
|
|
31
|
+
addChunk(blendshapes) {
|
|
32
|
+
const before = this.queue.length;
|
|
33
|
+
for (let i = 0; i < blendshapes.length; i++) {
|
|
34
|
+
this.queue.push(new Float32Array(blendshapes[i]));
|
|
35
|
+
}
|
|
36
|
+
const after = this.queue.length;
|
|
37
|
+
// console.log(`[BlendshapeQueue] Added ${blendshapes.length} frames. Queue: ${before} -> ${after}`);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Get all frames currently in the queue
|
|
41
|
+
* @returns Array of blendshape frames as Float32Arrays
|
|
42
|
+
*/
|
|
43
|
+
getFrames() {
|
|
44
|
+
return this.queue;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get a specific frame by index
|
|
48
|
+
* @param index - Frame index
|
|
49
|
+
* @returns The frame at the given index, or null if out of bounds
|
|
50
|
+
*/
|
|
51
|
+
getFrame(index) {
|
|
52
|
+
if (index < 0 || index >= this.queue.length) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return this.queue[index];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Remove frames from the beginning of the queue (consume frames)
|
|
59
|
+
* @param count - Number of frames to remove
|
|
60
|
+
*/
|
|
61
|
+
consumeFrames(count) {
|
|
62
|
+
if (count <= 0)
|
|
63
|
+
return;
|
|
64
|
+
this.queue.splice(0, Math.min(count, this.queue.length));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get the number of frames currently in the queue
|
|
68
|
+
*/
|
|
69
|
+
get length() {
|
|
70
|
+
return this.queue.length;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Check if queue has frames
|
|
74
|
+
*/
|
|
75
|
+
hasFrames() {
|
|
76
|
+
return this.queue.length > 0;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check if conversation is active
|
|
80
|
+
*/
|
|
81
|
+
isConversationActive() {
|
|
82
|
+
return this.conversationActive;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Check if conversation has ended (blendshape-turn-stats received)
|
|
86
|
+
*/
|
|
87
|
+
isConversationEnded() {
|
|
88
|
+
return this.conversationEnded;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Mark conversation start (called when bot-started-speaking)
|
|
92
|
+
*/
|
|
93
|
+
startConversation() {
|
|
94
|
+
this.conversationActive = true;
|
|
95
|
+
this.conversationEnded = false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Mark conversation end (called when blendshape-turn-stats received)
|
|
99
|
+
* Queue should be drained after this point
|
|
100
|
+
*/
|
|
101
|
+
endConversation() {
|
|
102
|
+
this.conversationEnded = true;
|
|
103
|
+
// Note: Don't set conversationActive to false yet - let consumer drain remaining frames
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Reset queue for new conversation
|
|
107
|
+
* Should be called after all frames have been consumed
|
|
108
|
+
*/
|
|
109
|
+
reset() {
|
|
110
|
+
this.queue = [];
|
|
111
|
+
this.conversationActive = false;
|
|
112
|
+
this.conversationEnded = false;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Add a post-processor to modify frames during playback
|
|
116
|
+
*/
|
|
117
|
+
addPostProcessor(processor) {
|
|
118
|
+
this.postProcessors.push(processor);
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Remove a post-processor
|
|
122
|
+
*/
|
|
123
|
+
removePostProcessor(processor) {
|
|
124
|
+
const index = this.postProcessors.indexOf(processor);
|
|
125
|
+
if (index !== -1) {
|
|
126
|
+
this.postProcessors.splice(index, 1);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Clear all post-processors
|
|
131
|
+
*/
|
|
132
|
+
clearPostProcessors() {
|
|
133
|
+
this.postProcessors = [];
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Apply all post-processors to a frame
|
|
137
|
+
*/
|
|
138
|
+
applyPostProcessing(frame, frameIndex) {
|
|
139
|
+
return this.postProcessors.reduce((processedFrame, processor) => processor(processedFrame, frameIndex, this.queue.length), frame);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get interpolated frame with zero-frame blending (always enabled)
|
|
143
|
+
* @param elapsedTime - Elapsed time in seconds
|
|
144
|
+
* @returns Interpolated frame with blending info
|
|
145
|
+
*/
|
|
146
|
+
getInterpolatedFrame(elapsedTime) {
|
|
147
|
+
if (this.queue.length === 0) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
const totalDuration = this.queue.length / BlendshapeQueue.TARGET_FPS;
|
|
151
|
+
const frameDuration = 1 / BlendshapeQueue.TARGET_FPS;
|
|
152
|
+
const halfFrameDuration = frameDuration * 0.5;
|
|
153
|
+
let startFrame;
|
|
154
|
+
let endFrame;
|
|
155
|
+
let alpha;
|
|
156
|
+
let frameIndex;
|
|
157
|
+
let isBlendingToZero = false;
|
|
158
|
+
// Beginning: blend from zero to first frame
|
|
159
|
+
if (elapsedTime <= halfFrameDuration) {
|
|
160
|
+
startFrame = BlendshapeQueue.ZERO_FRAME;
|
|
161
|
+
endFrame = this.queue[0];
|
|
162
|
+
alpha = elapsedTime / halfFrameDuration;
|
|
163
|
+
frameIndex = 0;
|
|
164
|
+
}
|
|
165
|
+
// End: blend from last frame to zero
|
|
166
|
+
else if (elapsedTime >= totalDuration - halfFrameDuration) {
|
|
167
|
+
startFrame = this.queue[this.queue.length - 1];
|
|
168
|
+
endFrame = BlendshapeQueue.ZERO_FRAME;
|
|
169
|
+
alpha =
|
|
170
|
+
(elapsedTime - (totalDuration - halfFrameDuration)) / halfFrameDuration;
|
|
171
|
+
frameIndex = this.queue.length - 1;
|
|
172
|
+
isBlendingToZero = true;
|
|
173
|
+
}
|
|
174
|
+
// Middle: normal interpolation
|
|
175
|
+
else {
|
|
176
|
+
const adjustedTime = elapsedTime - halfFrameDuration;
|
|
177
|
+
const currentFrameIndex = Math.floor(adjustedTime / frameDuration);
|
|
178
|
+
const nextFrameIndex = Math.min(currentFrameIndex + 1, this.queue.length - 1);
|
|
179
|
+
startFrame = this.queue[currentFrameIndex];
|
|
180
|
+
endFrame = this.queue[nextFrameIndex];
|
|
181
|
+
alpha = (adjustedTime % frameDuration) / frameDuration;
|
|
182
|
+
frameIndex = currentFrameIndex;
|
|
183
|
+
}
|
|
184
|
+
// Always interpolate for smooth animation
|
|
185
|
+
let resultFrame = this.interpolate(startFrame, endFrame, alpha);
|
|
186
|
+
// Apply post-processing
|
|
187
|
+
if (this.postProcessors.length > 0) {
|
|
188
|
+
resultFrame = this.applyPostProcessing(resultFrame, frameIndex);
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
frame: resultFrame,
|
|
192
|
+
frameIndex,
|
|
193
|
+
isBlendingToZero,
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Interpolate between two frames
|
|
198
|
+
*/
|
|
199
|
+
interpolate(start, end, alpha) {
|
|
200
|
+
const result = new Float32Array(Math.max(start.length, end.length));
|
|
201
|
+
const minLength = Math.min(start.length, end.length);
|
|
202
|
+
for (let i = 0; i < minLength; i++) {
|
|
203
|
+
const startVal = start[i] || 0;
|
|
204
|
+
const endVal = end[i] || 0;
|
|
205
|
+
result[i] = startVal + (endVal - startVal) * alpha;
|
|
206
|
+
}
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Get the zero frame (neutral pose)
|
|
211
|
+
*/
|
|
212
|
+
static getZeroFrame() {
|
|
213
|
+
return new Float32Array(BlendshapeQueue.ZERO_FRAME);
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Get debug info about the queue state
|
|
217
|
+
*/
|
|
218
|
+
getDebugInfo() {
|
|
219
|
+
return {
|
|
220
|
+
frameCount: this.queue.length,
|
|
221
|
+
conversationActive: this.conversationActive,
|
|
222
|
+
conversationEnded: this.conversationEnded,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// Constants
|
|
227
|
+
BlendshapeQueue.ZERO_FRAME = new Float32Array(52).fill(0);
|
|
228
|
+
BlendshapeQueue.TARGET_FPS = 60;
|
|
229
|
+
//# sourceMappingURL=BlendshapeQueue.js.map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