@convai/web-sdk 0.3.1-beta.3 → 0.3.2-beta.1
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 +112 -0
- package/dist/core/BlendshapeQueue.d.ts.map +1 -0
- package/dist/core/BlendshapeQueue.js +172 -0
- package/dist/core/BlendshapeQueue.js.map +1 -0
- package/dist/{types/core → core}/ConvaiClient.d.ts +5 -15
- package/dist/core/ConvaiClient.d.ts.map +1 -0
- package/dist/core/ConvaiClient.js +602 -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 +332 -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 +1 -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 +9 -23
- 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/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/createBlendshapeQueue.d.ts +86 -0
- package/dist/lipsync-helpers/createBlendshapeQueue.d.ts.map +1 -0
- package/dist/lipsync-helpers/createBlendshapeQueue.js +126 -0
- package/dist/lipsync-helpers/createBlendshapeQueue.js.map +1 -0
- package/dist/lipsync-helpers/declarativeMapping.d.ts +93 -0
- package/dist/lipsync-helpers/declarativeMapping.d.ts.map +1 -0
- package/dist/lipsync-helpers/declarativeMapping.js +228 -0
- package/dist/lipsync-helpers/declarativeMapping.js.map +1 -0
- package/dist/lipsync-helpers/index.d.ts +15 -0
- package/dist/lipsync-helpers/index.d.ts.map +1 -0
- package/dist/lipsync-helpers/index.js +31 -1164
- package/dist/lipsync-helpers/index.js.map +1 -0
- package/dist/lipsync-helpers/mappingTypes.d.ts +64 -0
- package/dist/lipsync-helpers/mappingTypes.d.ts.map +1 -0
- package/dist/lipsync-helpers/mappingTypes.js +28 -0
- package/dist/lipsync-helpers/mappingTypes.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/presetMappers.d.ts +24 -0
- package/dist/lipsync-helpers/presetMappers.d.ts.map +1 -0
- package/dist/lipsync-helpers/presetMappers.js +38 -0
- package/dist/lipsync-helpers/presetMappers.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 +179 -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/{types/vanilla → vanilla}/ConvaiWidget.d.ts +13 -6
- package/dist/vanilla/ConvaiWidget.d.ts.map +1 -0
- package/dist/vanilla/ConvaiWidget.js +1823 -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 +63 -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 +0 -80
- 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 +0 -155
- package/dist/types/lipsync-helpers/arkitPhonemeReference.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/index.d.ts +0 -9
- package/dist/types/lipsync-helpers/index.d.ts.map +0 -1
- package/dist/types/lipsync-helpers/neurosyncBlendshapeMapper.d.ts +0 -30
- 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}/arkitOrder61.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}/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,CAA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AI,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,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7B,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE;YAC5B,YAAY,EAAE,KAAK;YACnB,cAAc,EAAE,KAAK;YACrB,UAAU,EAAE,CAAC;SACd,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
+
* Mapping:
|
|
15
|
+
* - Supports optional mapping of blendshape data via a mapper function
|
|
16
|
+
* - Mapper is applied when frames are added to the queue
|
|
17
|
+
* - Common use cases: ARKit 61 → ARKit 52, MetaHuman 251 → Custom format
|
|
18
|
+
*/
|
|
19
|
+
export declare class BlendshapeQueue {
|
|
20
|
+
private queue;
|
|
21
|
+
private conversationActive;
|
|
22
|
+
private conversationEnded;
|
|
23
|
+
private mapper?;
|
|
24
|
+
private static readonly TARGET_FPS;
|
|
25
|
+
/**
|
|
26
|
+
* Create a new BlendshapeQueue
|
|
27
|
+
* @param mapper - Optional function to map/transform blendshape data as it's added
|
|
28
|
+
*/
|
|
29
|
+
constructor(mapper?: (input: number[] | Float32Array) => Float32Array);
|
|
30
|
+
/**
|
|
31
|
+
* Add a chunk of blendshapes to the queue
|
|
32
|
+
* @param blendshapes - Array of blendshape frames (each frame is an array of numbers)
|
|
33
|
+
*/
|
|
34
|
+
addChunk(blendshapes: number[][]): void;
|
|
35
|
+
/**
|
|
36
|
+
* Set or update the mapper function
|
|
37
|
+
* @param mapper - Function to map/transform blendshape data
|
|
38
|
+
*/
|
|
39
|
+
setMapper(mapper: (input: number[] | Float32Array) => Float32Array): void;
|
|
40
|
+
/**
|
|
41
|
+
* Clear the mapper function (passthrough mode)
|
|
42
|
+
*/
|
|
43
|
+
clearMapper(): void;
|
|
44
|
+
/**
|
|
45
|
+
* Check if a mapper is configured
|
|
46
|
+
*/
|
|
47
|
+
hasMapper(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Get all frames currently in the queue
|
|
50
|
+
* @returns Array of blendshape frames as Float32Arrays
|
|
51
|
+
*/
|
|
52
|
+
getFrames(): Float32Array[];
|
|
53
|
+
/**
|
|
54
|
+
* Get a specific frame by index
|
|
55
|
+
* @param index - Frame index
|
|
56
|
+
* @returns The frame at the given index, or null if out of bounds
|
|
57
|
+
*/
|
|
58
|
+
getFrame(index: number): Float32Array | null;
|
|
59
|
+
/**
|
|
60
|
+
* Remove frames from the beginning of the queue (consume frames)
|
|
61
|
+
* @param count - Number of frames to remove
|
|
62
|
+
*/
|
|
63
|
+
consumeFrames(count: number): void;
|
|
64
|
+
/**
|
|
65
|
+
* Get the number of frames currently in the queue
|
|
66
|
+
*/
|
|
67
|
+
get length(): number;
|
|
68
|
+
/**
|
|
69
|
+
* Check if queue has frames
|
|
70
|
+
*/
|
|
71
|
+
hasFrames(): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Check if conversation is active
|
|
74
|
+
*/
|
|
75
|
+
isConversationActive(): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Check if conversation has ended (blendshape-turn-stats received)
|
|
78
|
+
*/
|
|
79
|
+
isConversationEnded(): boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Mark conversation start (called when bot-started-speaking)
|
|
82
|
+
*/
|
|
83
|
+
startConversation(): void;
|
|
84
|
+
/**
|
|
85
|
+
* Mark conversation end (called when blendshape-turn-stats received)
|
|
86
|
+
* Queue should be drained after this point
|
|
87
|
+
*/
|
|
88
|
+
endConversation(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Reset queue for new conversation
|
|
91
|
+
* Should be called after all frames have been consumed
|
|
92
|
+
*/
|
|
93
|
+
reset(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get frame at specified time
|
|
96
|
+
* @param elapsedTime - Elapsed time in seconds
|
|
97
|
+
* @returns Frame data
|
|
98
|
+
*/
|
|
99
|
+
getFrameAtTime(elapsedTime: number): {
|
|
100
|
+
frame: Float32Array;
|
|
101
|
+
frameIndex: number;
|
|
102
|
+
} | null;
|
|
103
|
+
/**
|
|
104
|
+
* Get debug info about the queue state
|
|
105
|
+
*/
|
|
106
|
+
getDebugInfo(): {
|
|
107
|
+
frameCount: number;
|
|
108
|
+
conversationActive: boolean;
|
|
109
|
+
conversationEnded: boolean;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=BlendshapeQueue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlendshapeQueue.d.ts","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,KAAK,CAAsB;IACnC,OAAO,CAAC,kBAAkB,CAAkB;IAC5C,OAAO,CAAC,iBAAiB,CAAkB;IAC3C,OAAO,CAAC,MAAM,CAAC,CAAmD;IAGlE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAM;IAExC;;;OAGG;gBACS,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,KAAK,YAAY;IAIrE;;;OAGG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,GAAG,IAAI;IAcvC;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,YAAY,KAAK,YAAY,GAAG,IAAI;IAIzE;;OAEG;IACH,WAAW,IAAI,IAAI;IAInB;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;;OAGG;IACH,SAAS,IAAI,YAAY,EAAE;IAI3B;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI;IAO5C;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAKlC;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;OAEG;IACH,SAAS,IAAI,OAAO;IAIpB;;OAEG;IACH,oBAAoB,IAAI,OAAO;IAI/B;;OAEG;IACH,mBAAmB,IAAI,OAAO;IAI9B;;OAEG;IACH,iBAAiB,IAAI,IAAI;IAKzB;;;OAGG;IACH,eAAe,IAAI,IAAI;IAKvB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAMb;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG;QACnC,KAAK,EAAE,YAAY,CAAC;QACpB,UAAU,EAAE,MAAM,CAAC;KACpB,GAAG,IAAI;IAiBR;;OAEG;IACH,YAAY,IAAI;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,iBAAiB,EAAE,OAAO,CAAC;KAC5B;CAOF"}
|
|
@@ -0,0 +1,172 @@
|
|
|
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
|
+
* Mapping:
|
|
15
|
+
* - Supports optional mapping of blendshape data via a mapper function
|
|
16
|
+
* - Mapper is applied when frames are added to the queue
|
|
17
|
+
* - Common use cases: ARKit 61 → ARKit 52, MetaHuman 251 → Custom format
|
|
18
|
+
*/
|
|
19
|
+
export class BlendshapeQueue {
|
|
20
|
+
/**
|
|
21
|
+
* Create a new BlendshapeQueue
|
|
22
|
+
* @param mapper - Optional function to map/transform blendshape data as it's added
|
|
23
|
+
*/
|
|
24
|
+
constructor(mapper) {
|
|
25
|
+
this.queue = [];
|
|
26
|
+
this.conversationActive = false;
|
|
27
|
+
this.conversationEnded = false;
|
|
28
|
+
this.mapper = mapper;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Add a chunk of blendshapes to the queue
|
|
32
|
+
* @param blendshapes - Array of blendshape frames (each frame is an array of numbers)
|
|
33
|
+
*/
|
|
34
|
+
addChunk(blendshapes) {
|
|
35
|
+
const before = this.queue.length;
|
|
36
|
+
for (let i = 0; i < blendshapes.length; i++) {
|
|
37
|
+
const rawFrame = blendshapes[i];
|
|
38
|
+
// Apply mapper if provided, otherwise convert to Float32Array directly
|
|
39
|
+
const mappedFrame = this.mapper
|
|
40
|
+
? this.mapper(rawFrame)
|
|
41
|
+
: new Float32Array(rawFrame);
|
|
42
|
+
this.queue.push(mappedFrame);
|
|
43
|
+
}
|
|
44
|
+
const after = this.queue.length;
|
|
45
|
+
// console.log(`[BlendshapeQueue] Added ${blendshapes.length} frames. Queue: ${before} -> ${after}`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Set or update the mapper function
|
|
49
|
+
* @param mapper - Function to map/transform blendshape data
|
|
50
|
+
*/
|
|
51
|
+
setMapper(mapper) {
|
|
52
|
+
this.mapper = mapper;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Clear the mapper function (passthrough mode)
|
|
56
|
+
*/
|
|
57
|
+
clearMapper() {
|
|
58
|
+
this.mapper = undefined;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Check if a mapper is configured
|
|
62
|
+
*/
|
|
63
|
+
hasMapper() {
|
|
64
|
+
return this.mapper !== undefined;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Get all frames currently in the queue
|
|
68
|
+
* @returns Array of blendshape frames as Float32Arrays
|
|
69
|
+
*/
|
|
70
|
+
getFrames() {
|
|
71
|
+
return this.queue;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get a specific frame by index
|
|
75
|
+
* @param index - Frame index
|
|
76
|
+
* @returns The frame at the given index, or null if out of bounds
|
|
77
|
+
*/
|
|
78
|
+
getFrame(index) {
|
|
79
|
+
if (index < 0 || index >= this.queue.length) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
return this.queue[index];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Remove frames from the beginning of the queue (consume frames)
|
|
86
|
+
* @param count - Number of frames to remove
|
|
87
|
+
*/
|
|
88
|
+
consumeFrames(count) {
|
|
89
|
+
if (count <= 0)
|
|
90
|
+
return;
|
|
91
|
+
this.queue.splice(0, Math.min(count, this.queue.length));
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get the number of frames currently in the queue
|
|
95
|
+
*/
|
|
96
|
+
get length() {
|
|
97
|
+
return this.queue.length;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check if queue has frames
|
|
101
|
+
*/
|
|
102
|
+
hasFrames() {
|
|
103
|
+
return this.queue.length > 0;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Check if conversation is active
|
|
107
|
+
*/
|
|
108
|
+
isConversationActive() {
|
|
109
|
+
return this.conversationActive;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Check if conversation has ended (blendshape-turn-stats received)
|
|
113
|
+
*/
|
|
114
|
+
isConversationEnded() {
|
|
115
|
+
return this.conversationEnded;
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Mark conversation start (called when bot-started-speaking)
|
|
119
|
+
*/
|
|
120
|
+
startConversation() {
|
|
121
|
+
this.conversationActive = true;
|
|
122
|
+
this.conversationEnded = false;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Mark conversation end (called when blendshape-turn-stats received)
|
|
126
|
+
* Queue should be drained after this point
|
|
127
|
+
*/
|
|
128
|
+
endConversation() {
|
|
129
|
+
this.conversationEnded = true;
|
|
130
|
+
// Note: Don't set conversationActive to false yet - let consumer drain remaining frames
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Reset queue for new conversation
|
|
134
|
+
* Should be called after all frames have been consumed
|
|
135
|
+
*/
|
|
136
|
+
reset() {
|
|
137
|
+
this.queue = [];
|
|
138
|
+
this.conversationActive = false;
|
|
139
|
+
this.conversationEnded = false;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get frame at specified time
|
|
143
|
+
* @param elapsedTime - Elapsed time in seconds
|
|
144
|
+
* @returns Frame data
|
|
145
|
+
*/
|
|
146
|
+
getFrameAtTime(elapsedTime) {
|
|
147
|
+
if (this.queue.length === 0) {
|
|
148
|
+
return null;
|
|
149
|
+
}
|
|
150
|
+
// Calculate frame index based on elapsed time and target FPS
|
|
151
|
+
const frameIndex = Math.floor(elapsedTime * BlendshapeQueue.TARGET_FPS);
|
|
152
|
+
// Clamp to valid range
|
|
153
|
+
const clampedIndex = Math.min(frameIndex, this.queue.length - 1);
|
|
154
|
+
return {
|
|
155
|
+
frame: this.queue[clampedIndex],
|
|
156
|
+
frameIndex: clampedIndex,
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Get debug info about the queue state
|
|
161
|
+
*/
|
|
162
|
+
getDebugInfo() {
|
|
163
|
+
return {
|
|
164
|
+
frameCount: this.queue.length,
|
|
165
|
+
conversationActive: this.conversationActive,
|
|
166
|
+
conversationEnded: this.conversationEnded,
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
// Constants
|
|
171
|
+
BlendshapeQueue.TARGET_FPS = 60;
|
|
172
|
+
//# sourceMappingURL=BlendshapeQueue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BlendshapeQueue.js","sourceRoot":"","sources":["../../src/core/BlendshapeQueue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,OAAO,eAAe;IAS1B;;;OAGG;IACH,YAAY,MAAyD;QAZ7D,UAAK,GAAmB,EAAE,CAAC;QAC3B,uBAAkB,GAAY,KAAK,CAAC;QACpC,sBAAiB,GAAY,KAAK,CAAC;QAWzC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,WAAuB;QAC9B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5C,MAAM,QAAQ,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;YAChC,uEAAuE;YACvE,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM;gBAC7B,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACvB,CAAC,CAAC,IAAI,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC/B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC/B,CAAC;QACD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;QA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AAiB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED;;;OAGG;IACH,eAAe;QACb,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,wFAAwF;IAC1F,CAAC;IAED;;;OAGG;IACH,KAAK;QACH,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;QAChB,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;QAChC,IAAI,CAAC,iBAAiB,GAAG,KAAK,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACH,cAAc,CAAC,WAAmB;QAIhC,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC;QACd,CAAC;QAED,6DAA6D;QAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;QAExE,uBAAuB;QACvB,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAEjE,OAAO;YACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC;YAC/B,UAAU,EAAE,YAAY;SACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,YAAY;QAKV,OAAO;YACL,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC1C,CAAC;IACJ,CAAC;;AA7KD,YAAY;AACY,0BAAU,GAAG,EAAE,AAAL,CAAM"}
|
|
@@ -2,6 +2,7 @@ import { Room } from "livekit-client";
|
|
|
2
2
|
import { ConvaiConfig, ConvaiClientState, ChatMessage, IConvaiClient, AudioControls, VideoControls, ScreenShareControls } from "./types";
|
|
3
3
|
import { EventEmitter } from "./EventEmitter";
|
|
4
4
|
import { LatencyMonitor } from "../utils/LatencyMonitor";
|
|
5
|
+
import { BlendshapeQueue } from "./BlendshapeQueue";
|
|
5
6
|
/**
|
|
6
7
|
* Main Convai client class for managing AI voice assistant connections
|
|
7
8
|
* Provides complete interface for connecting to Convai's voice assistants,
|
|
@@ -55,6 +56,8 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
55
56
|
private _screenShareManager;
|
|
56
57
|
private _messageHandler;
|
|
57
58
|
private _latencyMonitor;
|
|
59
|
+
private _conversationSessionId;
|
|
60
|
+
private _conversationStartTime;
|
|
58
61
|
constructor(config?: ConvaiConfig);
|
|
59
62
|
get state(): ConvaiClientState;
|
|
60
63
|
get connectionType(): "audio" | "video" | null;
|
|
@@ -70,21 +73,8 @@ export declare class ConvaiClient extends EventEmitter implements IConvaiClient
|
|
|
70
73
|
get videoControls(): VideoControls;
|
|
71
74
|
get screenShareControls(): ScreenShareControls;
|
|
72
75
|
get latencyMonitor(): LatencyMonitor;
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
* Convenience getter - equivalent to audioControls.isAudioMuted
|
|
76
|
-
*/
|
|
77
|
-
get isAudioMuted(): boolean;
|
|
78
|
-
/**
|
|
79
|
-
* Whether the user's video is currently enabled
|
|
80
|
-
* Convenience getter - equivalent to videoControls.isVideoEnabled
|
|
81
|
-
*/
|
|
82
|
-
get isVideoEnabled(): boolean;
|
|
83
|
-
/**
|
|
84
|
-
* Whether screen sharing is currently active
|
|
85
|
-
* Convenience getter - equivalent to screenShareControls.isScreenShareActive
|
|
86
|
-
*/
|
|
87
|
-
get isScreenShareActive(): boolean;
|
|
76
|
+
get blendshapeQueue(): BlendshapeQueue;
|
|
77
|
+
get conversationSessionId(): number;
|
|
88
78
|
/**
|
|
89
79
|
* Setup event listeners for room and managers
|
|
90
80
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConvaiClient.d.ts","sourceRoot":"","sources":["../../src/core/ConvaiClient.ts"],"names":[],"mappings":"AAAA,OAAO,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