// using `await`, remember to use `async function(){}` as needed, or switch to Promise().then() if desired...
const myStream = await navigator.mediaDevices.getUserMedia({audio: true, video: true})
const myTracks = myStream.getTracks();
const myAudio = myTracks.filter(track => track.kind === "audio")[0];
const myVideo = myTracks.filter(track => track.kind === "video")[0];
function toggleTrackMute(track) {
track.enabled = !track.enabled;
console.log(`${track.enabled ? 'unmuted' : 'muted'} track.kind`);
}
toggleTrackMute(myAudio)