@layercode/js-sdk 2.4.0 → 2.6.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.
@@ -38,6 +38,7 @@ interface ILayercodeClient {
38
38
  getStream(): MediaStream | null;
39
39
  setInputDevice(deviceId: string): Promise<void>;
40
40
  setAudioInput(state: boolean): Promise<void>;
41
+ setAudioOutput(state: boolean): Promise<void>;
41
42
  listDevices(): Promise<Array<MediaDeviceInfo & {
42
43
  default: boolean;
43
44
  }>>;
@@ -68,8 +69,12 @@ interface LayercodeClientOptions {
68
69
  metadata?: Record<string, any>;
69
70
  /** Whether audio input is enabled. I.e. is the microphone turned on in the browser */
70
71
  audioInput?: boolean;
72
+ /** Whether audio output is enabled. I.e. do we play the sound in the browser client */
73
+ audioOutput?: boolean;
71
74
  /** Fired when audio input flag changes */
72
75
  audioInputChanged?: (audioInput: boolean) => void;
76
+ /** Fired when audio output flag changes */
77
+ audioOutputChanged?: (audioInput: boolean) => void;
73
78
  /** Milliseconds before resuming agent audio after temporary pause due to user interruption (which was actually a false interruption) */
74
79
  vadResumeDelay?: number;
75
80
  /** Callback when connection is established */
@@ -117,6 +122,7 @@ declare class LayercodeClient implements ILayercodeClient {
117
122
  private vad;
118
123
  private ws;
119
124
  private audioInput;
125
+ private audioOutput;
120
126
  private AMPLITUDE_MONITORING_SAMPLE_RATE;
121
127
  private pushToTalkActive;
122
128
  private pushToTalkEnabled;
@@ -184,11 +190,15 @@ declare class LayercodeClient implements ILayercodeClient {
184
190
  */
185
191
  private _setupAmplitudeMonitoring;
186
192
  private _stopAmplitudeMonitoring;
193
+ private _stopPlayerAmplitudeMonitoring;
194
+ private _stopRecorderAmplitudeMonitoring;
187
195
  audioInputConnect(): Promise<void>;
188
196
  audioInputDisconnect(): Promise<void>;
189
197
  setAudioInput(state: boolean): Promise<void>;
198
+ setAudioOutput(state: boolean): Promise<void>;
190
199
  /** Emitters for audio flags */
191
200
  private _emitAudioInput;
201
+ private _emitAudioOutput;
192
202
  get audioInputEnabled(): boolean;
193
203
  get userSpeaking(): boolean;
194
204
  get agentSpeaking(): boolean;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "author": "Layercode",
3
3
  "license": "MIT",
4
4
  "name": "@layercode/js-sdk",
5
- "version": "2.4.0",
5
+ "version": "2.6.0",
6
6
  "description": "Layercode JavaScript SDK for browser usage",
7
7
  "type": "module",
8
8
  "main": "dist/layercode-js-sdk.esm.js",