Reputation: 1085
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?
Upvotes: 5
Views: 1440
Reputation: 1085
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.
Upvotes: 8