@anganyai/voice-sdk 0.0.10 → 0.0.11
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/index.cjs +39 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +39 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1408,6 +1408,7 @@ declare class Conversation extends EventEmitter<ConversationEvents> {
|
|
|
1408
1408
|
}): Promise<void>;
|
|
1409
1409
|
/**
|
|
1410
1410
|
* Mute or unmute the user's microphone
|
|
1411
|
+
* This actually disables the local audio tracks to prevent sending audio
|
|
1411
1412
|
*/
|
|
1412
1413
|
mute(muted: boolean): void;
|
|
1413
1414
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1408,6 +1408,7 @@ declare class Conversation extends EventEmitter<ConversationEvents> {
|
|
|
1408
1408
|
}): Promise<void>;
|
|
1409
1409
|
/**
|
|
1410
1410
|
* Mute or unmute the user's microphone
|
|
1411
|
+
* This actually disables the local audio tracks to prevent sending audio
|
|
1411
1412
|
*/
|
|
1412
1413
|
mute(muted: boolean): void;
|
|
1413
1414
|
/**
|
package/dist/index.js
CHANGED
|
@@ -16732,14 +16732,49 @@ var SipManager = class extends EventEmitter {
|
|
|
16732
16732
|
}
|
|
16733
16733
|
}
|
|
16734
16734
|
/**
|
|
16735
|
-
* Mute or unmute the remote audio
|
|
16735
|
+
* Mute or unmute the remote audio (output/speaker)
|
|
16736
16736
|
*/
|
|
16737
16737
|
setMuted(muted) {
|
|
16738
16738
|
if (this.audioElement) {
|
|
16739
16739
|
this.audioElement.muted = muted;
|
|
16740
|
-
this.logger.debug("
|
|
16740
|
+
this.logger.debug("Remote audio mute state changed", { muted });
|
|
16741
16741
|
}
|
|
16742
16742
|
}
|
|
16743
|
+
/**
|
|
16744
|
+
* Mute or unmute the local audio (microphone input)
|
|
16745
|
+
* This actually disables the audio tracks to prevent sending audio
|
|
16746
|
+
*/
|
|
16747
|
+
setLocalAudioEnabled(enabled) {
|
|
16748
|
+
if (this.localStream) {
|
|
16749
|
+
this.localStream.getAudioTracks().forEach((track) => {
|
|
16750
|
+
track.enabled = enabled;
|
|
16751
|
+
this.logger.debug("Local audio track enabled state changed", {
|
|
16752
|
+
trackId: track.id,
|
|
16753
|
+
enabled: track.enabled
|
|
16754
|
+
});
|
|
16755
|
+
});
|
|
16756
|
+
}
|
|
16757
|
+
if (this.preAcquiredStream && this.preAcquiredStream !== this.localStream) {
|
|
16758
|
+
this.preAcquiredStream.getAudioTracks().forEach((track) => {
|
|
16759
|
+
track.enabled = enabled;
|
|
16760
|
+
this.logger.debug("Pre-acquired audio track enabled state changed", {
|
|
16761
|
+
trackId: track.id,
|
|
16762
|
+
enabled: track.enabled
|
|
16763
|
+
});
|
|
16764
|
+
});
|
|
16765
|
+
}
|
|
16766
|
+
this.logger.info("Local audio (microphone) " + (enabled ? "enabled" : "disabled"));
|
|
16767
|
+
}
|
|
16768
|
+
/**
|
|
16769
|
+
* Check if local audio is enabled
|
|
16770
|
+
*/
|
|
16771
|
+
isLocalAudioEnabled() {
|
|
16772
|
+
if (this.localStream) {
|
|
16773
|
+
const tracks = this.localStream.getAudioTracks();
|
|
16774
|
+
return tracks.length > 0 && tracks.every((track) => track.enabled);
|
|
16775
|
+
}
|
|
16776
|
+
return false;
|
|
16777
|
+
}
|
|
16743
16778
|
startAudioMonitoring() {
|
|
16744
16779
|
if (!this.localStream || this.audioMonitorInterval) {
|
|
16745
16780
|
return;
|
|
@@ -17812,10 +17847,12 @@ var Conversation = class extends EventEmitter {
|
|
|
17812
17847
|
}
|
|
17813
17848
|
/**
|
|
17814
17849
|
* Mute or unmute the user's microphone
|
|
17850
|
+
* This actually disables the local audio tracks to prevent sending audio
|
|
17815
17851
|
*/
|
|
17816
17852
|
mute(muted) {
|
|
17817
17853
|
this.logger.debug("Setting user mute", { muted });
|
|
17818
17854
|
this.userMuted = muted;
|
|
17855
|
+
this.sipManager.setLocalAudioEnabled(!muted);
|
|
17819
17856
|
this.emit("userMuted", muted);
|
|
17820
17857
|
}
|
|
17821
17858
|
/**
|