twilio / twilio-voice.js

Twilio's JavaScript Voice SDK
Other
50 stars 54 forks source link

[QUESTION] How to mute loud speaker output audio in speaker devices? #269

Open tashikrispcall opened 1 month ago

tashikrispcall commented 1 month ago

Can we directly set device.audio.speakerDevices to undefined to achieve this ? or is there a proper work around ? image

charliesantos commented 1 month ago

Hi @tashikrispcall , thanks for reaching out! Are you trying to mute these sounds? https://www.twilio.com/docs/voice/sdks/javascript/twiliodevice#deviceoptionssounds-properties-and-default-sounds

Or are you trying to mute the audio of the remote party? For example, if Alice calls Bob, are you trying to mute Bob?

tashikrispcall commented 1 month ago

Hi @charliesantos , yes, I'm trying to mute the audio of the remote party i.e. if I'm in call with Bob, I'm trying to mute Bob.

charliesantos commented 1 month ago

There is no mute API for remote party at the moment. However, you can get the remote stream using call.getRemoteStream(). This is a MediaStream object that you can use to mute the audio track. For example

call.getRemoteStream().getAudioTracks().forEach(track => track.enabled = false);
tashikrispcall commented 1 month ago

Thanks, I'll try implementing this.