I'm adapting Twilio's JS Quickstart and trying to provide a button that will mute a user's audio. From looking around online, my code looks like this:
function toggleAudio(){
room.localParticipant.audioTracks.forEach(function(track) {
console.log(track);
track.disable();
})
}
The console.log() spits out a LocalAudioTrackPublication
, yet I get the following error:
Uncaught TypeError: track.disable is not a function
So I'm stumped. The docs imply that the .disable()
method will do what I expect, yet apparently, it's not defined?
It was such a ridiculously simple solution, as is always the case.
function toggleAudio(){
room.localParticipant.audioTracks.forEach(function(track) {
track.track.disable();
})
}
The actual track is inside of the track property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With