This message was deleted.
# helpdesk
s
This message was deleted.
a
what do you mean by “on demand”? you mean like, after you’ve already started publishing the track?
n
yes
what I was thinking is like changing is to active or not as the user desires, maybe is stupid to ask for this but was curions
since the deviceId can be switched I thought maybe is a way for this also?
a
ah yeah. okay so you can pass AudioCaptureOptions to the
restartTrack()
method, like so:
Copy code
await localAudioTrack.restartTrack({ noiseSuppression: true });
n
ok, but how do I get the localAudioTrack?
a
are you using React Components or plain JavaScript?
n
React
but the version witch got archived in August
did not migrate to the new version yet
a
I’d use the useLocalParticipant hook and get the
microphoneTrack
from that-
n
I assume like this
Copy code
const audioTrack = roomCall.localParticipant.getTrack(
  Track.Source.Microphone,
)!.track as LocalAudioTrack;

audioTrack.restartTrack({ noiseSuppression: true })
a
yeah if you already have a reference to the
Room
then that will work too
n
yes, my roomCall is the Room type
👍 1
a
be careful about that
!
though, that will cause an exception if the user doesn’t have a mic track for whatever reason
n
yap, you’re right
I have set up Sentry everywhere for tracking exception that may occour
👍 1
😅
Hey, @acoustic-engineer-41666, do you know how I can get access of the
noiseSuppression
value after changed w/o myself remember the value having it by default to
true
?
Also not sure if I do something wrong or not but to be honest I’m not sure if this:
Copy code
audioTrack.restartTrack({ noiseSuppression: true })
being true or false does anything since not sure if I can spot any difference in the sound i can hear so…
also switching form the room default init with this noiseSuppression either
true
or
false
I cannot spot a difference so a bit weird I would say