@rapidaai/react 1.1.45 → 1.1.46
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/{chunk-DRBNQMZR.mjs → chunk-CKIZ6YUP.mjs} +16 -7
- package/dist/{chunk-DRBNQMZR.mjs.map → chunk-CKIZ6YUP.mjs.map} +1 -1
- package/dist/components/device-selector.d.mts +1 -1
- package/dist/components/device-selector.d.ts +1 -1
- package/dist/components/device-selector.js +15 -6
- package/dist/components/device-selector.js.map +1 -1
- package/dist/components/device-selector.mjs +1 -1
- package/dist/{device-selector-D7AEGpZu.d.mts → device-selector-CoAQBhd-.d.mts} +1 -0
- package/dist/{device-selector-D7AEGpZu.d.ts → device-selector-CoAQBhd-.d.ts} +1 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +15 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -29357,9 +29357,7 @@ var VoiceAgent = class extends Agent {
|
|
|
29357
29357
|
};
|
|
29358
29358
|
connectDevice = async () => {
|
|
29359
29359
|
try {
|
|
29360
|
-
this.preliminaryInputStream = await
|
|
29361
|
-
audio: true
|
|
29362
|
-
});
|
|
29360
|
+
this.preliminaryInputStream = await this.waitForUserMediaPermission();
|
|
29363
29361
|
[this.input, this.output] = await Promise.all([
|
|
29364
29362
|
Input.create(this.agentConfig.inputOptions.recorderOption),
|
|
29365
29363
|
Output.create(this.agentConfig.outputOptions.playerOption)
|
|
@@ -29370,7 +29368,19 @@ var VoiceAgent = class extends Agent {
|
|
|
29370
29368
|
this.preliminaryInputStream = null;
|
|
29371
29369
|
} catch (error) {
|
|
29372
29370
|
await this.disconnectAudio();
|
|
29373
|
-
console.
|
|
29371
|
+
console.error("Microphone permission error:", error);
|
|
29372
|
+
}
|
|
29373
|
+
};
|
|
29374
|
+
// Helper method to handle media permissions:
|
|
29375
|
+
waitForUserMediaPermission = async () => {
|
|
29376
|
+
try {
|
|
29377
|
+
return await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
29378
|
+
} catch (error) {
|
|
29379
|
+
console.error(
|
|
29380
|
+
"Permission denied or error while requesting microphone access:",
|
|
29381
|
+
error
|
|
29382
|
+
);
|
|
29383
|
+
throw error;
|
|
29374
29384
|
}
|
|
29375
29385
|
};
|
|
29376
29386
|
/**
|
|
@@ -29417,7 +29427,6 @@ var VoiceAgent = class extends Agent {
|
|
|
29417
29427
|
console.log("Please call connect first, agent is not connected");
|
|
29418
29428
|
return;
|
|
29419
29429
|
}
|
|
29420
|
-
const maxVolume = event.data[1];
|
|
29421
29430
|
if (this.inputChannel == "audio" /* Audio */)
|
|
29422
29431
|
this.talkingConnection?.write(
|
|
29423
29432
|
this.createAssistantAudioMessage(
|
|
@@ -29483,10 +29492,10 @@ var VoiceAgent = class extends Agent {
|
|
|
29483
29492
|
*/
|
|
29484
29493
|
connect = async () => {
|
|
29485
29494
|
try {
|
|
29486
|
-
await this.connectAgent();
|
|
29487
29495
|
if (this.inputChannel == "audio" /* Audio */) {
|
|
29488
29496
|
await this.connectAudio();
|
|
29489
29497
|
}
|
|
29498
|
+
await this.connectAgent();
|
|
29490
29499
|
} catch (err) {
|
|
29491
29500
|
console.error("error while connect " + err);
|
|
29492
29501
|
}
|
|
@@ -30171,4 +30180,4 @@ export {
|
|
|
30171
30180
|
useSelectInputDeviceAgent,
|
|
30172
30181
|
DeviceSelectorComponent
|
|
30173
30182
|
};
|
|
30174
|
-
//# sourceMappingURL=chunk-
|
|
30183
|
+
//# sourceMappingURL=chunk-CKIZ6YUP.mjs.map
|