I am able to mute the sound going into the microphone, but not the sound ing out of the speakers. To be specific, I'm only trying to mute the Twilio call, not other sounds in the browser, and certainly not system sounds.
I am able to mute the sound going into the microphone, but not the sound ing out of the speakers. To be specific, I'm only trying to mute the Twilio call, not other sounds in the browser, and certainly not system sounds.
Share Improve this question asked Sep 26, 2013 at 18:19 TrevorTrevor 13.5k13 gold badges82 silver badges103 bronze badges3 Answers
Reset to default 4Its straightforward using the Javascript 1.4 library, without needing conference calls etc.
https://www.twilio./docs/api/client/connection
e.g.
Twilio.Device.activeConnection().mute(true);
if the call is between 2 persons only, then this can be done by creating a conference in twilio and muting the other person during the call. This will make the server reject the voice input from the other party.
However, to pletely stop the sound on your side local, i would suggest using javascript to alter the flash player privileges to restrict the hardware access when you want the call to be muted.
Here is working example
$scope.togglePublishAudio = function togglePublishAudio() {
$log.debug('Toggling publish audio');
if (activeRoom.localParticipant.media.isMuted === false) {
$scope.isMuted = true;
activeRoom.localParticipant.media.mute();
} else {
$scope.isMuted = false;
activeRoom.localParticipant.media.unmute();
}
};
In new Version of twilio
var localMedia = room.localParticipant;
localMedia.tracks.forEach(function (track) {
if (track.isEnabled) {
track.disable();
$scope.isPaused = true;
} else {
track.enable();
$scope.isPaused = false;
}
});