@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
|
@@ -28613,9 +28613,7 @@ var VoiceAgent = class extends Agent {
|
|
|
28613
28613
|
};
|
|
28614
28614
|
connectDevice = async () => {
|
|
28615
28615
|
try {
|
|
28616
|
-
this.preliminaryInputStream = await
|
|
28617
|
-
audio: true
|
|
28618
|
-
});
|
|
28616
|
+
this.preliminaryInputStream = await this.waitForUserMediaPermission();
|
|
28619
28617
|
[this.input, this.output] = await Promise.all([
|
|
28620
28618
|
Input.create(this.agentConfig.inputOptions.recorderOption),
|
|
28621
28619
|
Output.create(this.agentConfig.outputOptions.playerOption)
|
|
@@ -28626,7 +28624,19 @@ var VoiceAgent = class extends Agent {
|
|
|
28626
28624
|
this.preliminaryInputStream = null;
|
|
28627
28625
|
} catch (error) {
|
|
28628
28626
|
await this.disconnectAudio();
|
|
28629
|
-
console.
|
|
28627
|
+
console.error("Microphone permission error:", error);
|
|
28628
|
+
}
|
|
28629
|
+
};
|
|
28630
|
+
// Helper method to handle media permissions:
|
|
28631
|
+
waitForUserMediaPermission = async () => {
|
|
28632
|
+
try {
|
|
28633
|
+
return await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
28634
|
+
} catch (error) {
|
|
28635
|
+
console.error(
|
|
28636
|
+
"Permission denied or error while requesting microphone access:",
|
|
28637
|
+
error
|
|
28638
|
+
);
|
|
28639
|
+
throw error;
|
|
28630
28640
|
}
|
|
28631
28641
|
};
|
|
28632
28642
|
/**
|
|
@@ -28673,7 +28683,6 @@ var VoiceAgent = class extends Agent {
|
|
|
28673
28683
|
console.log("Please call connect first, agent is not connected");
|
|
28674
28684
|
return;
|
|
28675
28685
|
}
|
|
28676
|
-
const maxVolume = event.data[1];
|
|
28677
28686
|
if (this.inputChannel == "audio" /* Audio */)
|
|
28678
28687
|
this.talkingConnection?.write(
|
|
28679
28688
|
this.createAssistantAudioMessage(
|
|
@@ -28739,10 +28748,10 @@ var VoiceAgent = class extends Agent {
|
|
|
28739
28748
|
*/
|
|
28740
28749
|
connect = async () => {
|
|
28741
28750
|
try {
|
|
28742
|
-
await this.connectAgent();
|
|
28743
28751
|
if (this.inputChannel == "audio" /* Audio */) {
|
|
28744
28752
|
await this.connectAudio();
|
|
28745
28753
|
}
|
|
28754
|
+
await this.connectAgent();
|
|
28746
28755
|
} catch (err) {
|
|
28747
28756
|
console.error("error while connect " + err);
|
|
28748
28757
|
}
|