@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.cjs
CHANGED
|
@@ -16734,14 +16734,49 @@ var SipManager = class extends EventEmitter {
|
|
|
16734
16734
|
}
|
|
16735
16735
|
}
|
|
16736
16736
|
/**
|
|
16737
|
-
* Mute or unmute the remote audio
|
|
16737
|
+
* Mute or unmute the remote audio (output/speaker)
|
|
16738
16738
|
*/
|
|
16739
16739
|
setMuted(muted) {
|
|
16740
16740
|
if (this.audioElement) {
|
|
16741
16741
|
this.audioElement.muted = muted;
|
|
16742
|
-
this.logger.debug("
|
|
16742
|
+
this.logger.debug("Remote audio mute state changed", { muted });
|
|
16743
16743
|
}
|
|
16744
16744
|
}
|
|
16745
|
+
/**
|
|
16746
|
+
* Mute or unmute the local audio (microphone input)
|
|
16747
|
+
* This actually disables the audio tracks to prevent sending audio
|
|
16748
|
+
*/
|
|
16749
|
+
setLocalAudioEnabled(enabled) {
|
|
16750
|
+
if (this.localStream) {
|
|
16751
|
+
this.localStream.getAudioTracks().forEach((track) => {
|
|
16752
|
+
track.enabled = enabled;
|
|
16753
|
+
this.logger.debug("Local audio track enabled state changed", {
|
|
16754
|
+
trackId: track.id,
|
|
16755
|
+
enabled: track.enabled
|
|
16756
|
+
});
|
|
16757
|
+
});
|
|
16758
|
+
}
|
|
16759
|
+
if (this.preAcquiredStream && this.preAcquiredStream !== this.localStream) {
|
|
16760
|
+
this.preAcquiredStream.getAudioTracks().forEach((track) => {
|
|
16761
|
+
track.enabled = enabled;
|
|
16762
|
+
this.logger.debug("Pre-acquired audio track enabled state changed", {
|
|
16763
|
+
trackId: track.id,
|
|
16764
|
+
enabled: track.enabled
|
|
16765
|
+
});
|
|
16766
|
+
});
|
|
16767
|
+
}
|
|
16768
|
+
this.logger.info("Local audio (microphone) " + (enabled ? "enabled" : "disabled"));
|
|
16769
|
+
}
|
|
16770
|
+
/**
|
|
16771
|
+
* Check if local audio is enabled
|
|
16772
|
+
*/
|
|
16773
|
+
isLocalAudioEnabled() {
|
|
16774
|
+
if (this.localStream) {
|
|
16775
|
+
const tracks = this.localStream.getAudioTracks();
|
|
16776
|
+
return tracks.length > 0 && tracks.every((track) => track.enabled);
|
|
16777
|
+
}
|
|
16778
|
+
return false;
|
|
16779
|
+
}
|
|
16745
16780
|
startAudioMonitoring() {
|
|
16746
16781
|
if (!this.localStream || this.audioMonitorInterval) {
|
|
16747
16782
|
return;
|
|
@@ -17814,10 +17849,12 @@ var Conversation = class extends EventEmitter {
|
|
|
17814
17849
|
}
|
|
17815
17850
|
/**
|
|
17816
17851
|
* Mute or unmute the user's microphone
|
|
17852
|
+
* This actually disables the local audio tracks to prevent sending audio
|
|
17817
17853
|
*/
|
|
17818
17854
|
mute(muted) {
|
|
17819
17855
|
this.logger.debug("Setting user mute", { muted });
|
|
17820
17856
|
this.userMuted = muted;
|
|
17857
|
+
this.sipManager.setLocalAudioEnabled(!muted);
|
|
17821
17858
|
this.emit("userMuted", muted);
|
|
17822
17859
|
}
|
|
17823
17860
|
/**
|