@layercode/js-sdk 1.0.26 → 1.0.27
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/types/index.d.ts
CHANGED
|
@@ -35,6 +35,8 @@ interface LayercodeClientOptions {
|
|
|
35
35
|
onDisconnect?: () => void;
|
|
36
36
|
/** Callback when an error occurs */
|
|
37
37
|
onError?: (error: Error) => void;
|
|
38
|
+
/** Callback when a device is switched */
|
|
39
|
+
onDeviceSwitched?: (deviceId: string) => void;
|
|
38
40
|
/** Callback for data messages */
|
|
39
41
|
onDataMessage?: (message: any) => void;
|
|
40
42
|
/** Callback for user audio amplitude changes */
|
|
@@ -65,6 +67,8 @@ declare class LayercodeClient implements ILayercodeClient {
|
|
|
65
67
|
private readySent;
|
|
66
68
|
private currentTurnId;
|
|
67
69
|
private audioBuffer;
|
|
70
|
+
private vadConfig;
|
|
71
|
+
private deviceId;
|
|
68
72
|
_websocketUrl: string;
|
|
69
73
|
status: string;
|
|
70
74
|
userAudioAmplitude: number;
|
|
@@ -75,7 +79,6 @@ declare class LayercodeClient implements ILayercodeClient {
|
|
|
75
79
|
* @param {Object} options - Configuration options
|
|
76
80
|
*/
|
|
77
81
|
constructor(options: LayercodeClientOptions);
|
|
78
|
-
private _setupAmplitudeBasedVAD;
|
|
79
82
|
private _initializeVAD;
|
|
80
83
|
/**
|
|
81
84
|
* Updates the connection status and triggers the callback
|
|
@@ -126,6 +129,18 @@ declare class LayercodeClient implements ILayercodeClient {
|
|
|
126
129
|
* @param {string} deviceId - The deviceId of the new microphone
|
|
127
130
|
*/
|
|
128
131
|
setInputDevice(deviceId: string): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Restarts audio recording after a device switch to ensure audio is captured from the new device
|
|
134
|
+
*/
|
|
135
|
+
private _restartAudioRecording;
|
|
136
|
+
/**
|
|
137
|
+
* Reinitializes VAD with a new stream (used after device switching)
|
|
138
|
+
*/
|
|
139
|
+
private _reinitializeVAD;
|
|
140
|
+
/**
|
|
141
|
+
* Sets up the device change event listener
|
|
142
|
+
*/
|
|
143
|
+
private _setupDeviceChangeListener;
|
|
129
144
|
}
|
|
130
145
|
export default LayercodeClient;
|
|
131
146
|
export type { ILayercodeClient, LayercodeClientOptions };
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "Layercode",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"name": "@layercode/js-sdk",
|
|
5
|
-
"version": "1.0.
|
|
5
|
+
"version": "1.0.27",
|
|
6
6
|
"description": "Layercode JavaScript SDK for browser usage",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"main": "dist/layercode-js-sdk.esm.js",
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"@ricky0123/vad-web": "^0.0.24",
|
|
49
49
|
"onnxruntime-web": "^1.21.1"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|