@layercode/js-sdk 2.1.5 → 2.1.7

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.
@@ -8,6 +8,9 @@ interface ILayercodeClient {
8
8
  triggerUserTurnFinished(): Promise<void>;
9
9
  getStream(): MediaStream | null;
10
10
  setInputDevice(deviceId: string): Promise<void>;
11
+ listDevices(): Promise<Array<MediaDeviceInfo & {
12
+ default: boolean;
13
+ }>>;
11
14
  mute(): void;
12
15
  unmute(): void;
13
16
  readonly status: string;
@@ -40,6 +43,10 @@ interface LayercodeClientOptions {
40
43
  onError?: (error: Error) => void;
41
44
  /** Callback when a device is switched */
42
45
  onDeviceSwitched?: (deviceId: string) => void;
46
+ /** Callback when available devices change (devices added/removed) */
47
+ onDevicesChanged?: (devices: Array<MediaDeviceInfo & {
48
+ default: boolean;
49
+ }>) => void;
43
50
  /** Callback for data messages */
44
51
  onDataMessage?: (message: any) => void;
45
52
  /** Callback for other messages (excluding audio msgs) */
@@ -140,6 +147,13 @@ declare class LayercodeClient implements ILayercodeClient {
140
147
  * @returns {MediaStream|null} The microphone stream or null if not initialized
141
148
  */
142
149
  getStream(): MediaStream | null;
150
+ /**
151
+ * List all available audio input devices
152
+ * @returns {Promise<Array<MediaDeviceInfo & {default: boolean}>>}
153
+ */
154
+ listDevices(): Promise<Array<MediaDeviceInfo & {
155
+ default: boolean;
156
+ }>>;
143
157
  /**
144
158
  * Switches the input device for the microphone and restarts recording
145
159
  * @param {string} deviceId - The deviceId of the new microphone
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.1.5",
5
+ "version": "2.1.7",
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
+ }