@layercode/js-sdk 2.8.6 → 2.8.8
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.
|
@@ -5833,7 +5833,7 @@ registerProcessor('audio_processor', AudioProcessor);
|
|
|
5833
5833
|
* @param {Object} options - Configuration options
|
|
5834
5834
|
*/
|
|
5835
5835
|
constructor(options) {
|
|
5836
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
|
|
5836
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
5837
5837
|
this.deviceId = null;
|
|
5838
5838
|
this.options = {
|
|
5839
5839
|
agentId: options.agentId,
|
|
@@ -5845,24 +5845,25 @@ registerProcessor('audio_processor', AudioProcessor);
|
|
|
5845
5845
|
audioInput: (_d = options.audioInput) !== null && _d !== void 0 ? _d : true,
|
|
5846
5846
|
audioInputChanged: (_e = options.audioInputChanged) !== null && _e !== void 0 ? _e : NOOP,
|
|
5847
5847
|
audioOutput: (_f = options.audioOutput) !== null && _f !== void 0 ? _f : true,
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
|
|
5852
|
-
|
|
5853
|
-
|
|
5854
|
-
|
|
5855
|
-
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5859
|
-
|
|
5860
|
-
|
|
5861
|
-
|
|
5862
|
-
|
|
5848
|
+
enableVAD: (_g = options.enableVAD) !== null && _g !== void 0 ? _g : true,
|
|
5849
|
+
audioOutputChanged: (_h = options.audioOutputChanged) !== null && _h !== void 0 ? _h : NOOP,
|
|
5850
|
+
onConnect: (_j = options.onConnect) !== null && _j !== void 0 ? _j : NOOP,
|
|
5851
|
+
onDisconnect: (_k = options.onDisconnect) !== null && _k !== void 0 ? _k : NOOP,
|
|
5852
|
+
onError: (_l = options.onError) !== null && _l !== void 0 ? _l : NOOP,
|
|
5853
|
+
onDeviceSwitched: (_m = options.onDeviceSwitched) !== null && _m !== void 0 ? _m : NOOP,
|
|
5854
|
+
onDevicesChanged: (_o = options.onDevicesChanged) !== null && _o !== void 0 ? _o : NOOP,
|
|
5855
|
+
onDataMessage: (_p = options.onDataMessage) !== null && _p !== void 0 ? _p : NOOP,
|
|
5856
|
+
onMessage: (_q = options.onMessage) !== null && _q !== void 0 ? _q : NOOP,
|
|
5857
|
+
onUserAmplitudeChange: (_r = options.onUserAmplitudeChange) !== null && _r !== void 0 ? _r : NOOP,
|
|
5858
|
+
onAgentAmplitudeChange: (_s = options.onAgentAmplitudeChange) !== null && _s !== void 0 ? _s : NOOP,
|
|
5859
|
+
onStatusChange: (_t = options.onStatusChange) !== null && _t !== void 0 ? _t : NOOP,
|
|
5860
|
+
onUserIsSpeakingChange: (_u = options.onUserIsSpeakingChange) !== null && _u !== void 0 ? _u : NOOP,
|
|
5861
|
+
onAgentSpeakingChange: (_v = options.onAgentSpeakingChange) !== null && _v !== void 0 ? _v : NOOP,
|
|
5862
|
+
onMuteStateChange: (_w = options.onMuteStateChange) !== null && _w !== void 0 ? _w : NOOP,
|
|
5863
|
+
enableAmplitudeMonitoring: (_x = options.enableAmplitudeMonitoring) !== null && _x !== void 0 ? _x : true,
|
|
5863
5864
|
};
|
|
5864
|
-
this.audioInput = (
|
|
5865
|
-
this.audioOutput = (
|
|
5865
|
+
this.audioInput = (_y = options.audioInput) !== null && _y !== void 0 ? _y : true;
|
|
5866
|
+
this.audioOutput = (_z = options.audioOutput) !== null && _z !== void 0 ? _z : true;
|
|
5866
5867
|
this._emitAudioInput();
|
|
5867
5868
|
this.AMPLITUDE_MONITORING_SAMPLE_RATE = 2;
|
|
5868
5869
|
this._websocketUrl = DEFAULT_WS_URL;
|
|
@@ -5879,6 +5880,7 @@ registerProcessor('audio_processor', AudioProcessor);
|
|
|
5879
5880
|
this.agentAudioAmplitude = 0;
|
|
5880
5881
|
this.conversationId = this.options.conversationId;
|
|
5881
5882
|
this.pushToTalkActive = false;
|
|
5883
|
+
this.enableVAD = (_0 = this.options.enableVAD) !== null && _0 !== void 0 ? _0 : true;
|
|
5882
5884
|
this.pushToTalkEnabled = false;
|
|
5883
5885
|
this.canInterrupt = false;
|
|
5884
5886
|
this.userIsSpeaking = false;
|
|
@@ -5922,6 +5924,11 @@ registerProcessor('audio_processor', AudioProcessor);
|
|
|
5922
5924
|
async _initializeVAD() {
|
|
5923
5925
|
var _a;
|
|
5924
5926
|
console.log('initializing VAD', { pushToTalkEnabled: this.pushToTalkEnabled, canInterrupt: this.canInterrupt, vadConfig: this.vadConfig });
|
|
5927
|
+
// sometimes users want to disable vad to reduce work on client side
|
|
5928
|
+
if (!this.enableVAD) {
|
|
5929
|
+
console.debug('Skipping VAD init: VAD disabled');
|
|
5930
|
+
return;
|
|
5931
|
+
}
|
|
5925
5932
|
// If we're in push to talk mode or mute mode, we don't need to use the VAD model
|
|
5926
5933
|
if (this.pushToTalkEnabled || !this._shouldCaptureUserAudio()) {
|
|
5927
5934
|
console.debug('Skipping VAD init: audio input disabled or muted');
|