1

For tracks that the localParticipant constructs and publishes manually, enabling/disabling those tracks apparently has no effect on remote participants. So for example, if a localParticipant wanted to mute their audio, the remote participant will continue to receive that localParticipant's audio.

I found at least 2 ways to reproduce this error:

  1. When a participant first connects to a room, if the participant constructs their own tracks object and passes it in as a connect option like so:
Twilio.Video.connect(twilioToken, {
  name: roomName,
  tracks: [LocalTrack|MediaStreamTrack] // The tracks array is constructed by converting from a MediaStream object containing 1 audio and 1 video track
})

Those tracks will get published successfully but not register their enable/disable events.

However, if the participant connects to the room like so:

Twilio.Video.connect(twilioToken, {
  name: roomName,
  video: true,
  audio: true,
})

the track enable/disable events fire for those tracks and the remote participant will be notified when the localPartipants disables any tracks.

  1. When a localParticipant publishes a new track constructed manually, the new track's enable/disable events will not fire off to remoteParticipants.
    const newLocalAudioTrack = new Twilio.Video.LocalAudioTrack(newAudioTrack); //newAudioTrack is a MediaStreamTrack object
    localParticipant.publishTrack(newLocalAudioTrack); // track gets successfully published

    // Trying to disable track after track has been published and registered by the remoteParticipant
    localParticipant.audioTracks.forEach((publication) => { publication.track.disable(); }); // This will not work and remote Participant will continue to receive audio, no disable event is registered by any remoteParticipants

Project Environment: Node.js, Twilio-video@2.12.0, Twilio@3.56.0

Please let me know if you need any other details.

xz254
  • 11
  • 1

1 Answers1

0

function roomJoined(room) {

$('#call-microphone').click(function ()
{
    console.log('MICROPHONE MUTED');
    if (microphone) {
        room.localParticipant.audioTracks.forEach(function (audioTrack) {
            console.log("audioTrack-- "+audioTrack);
            audioTrack.disable();
        });
        microphone = false;
        $('#call-microphone').html('<span class="fa fa-microphone"></span> ');
        console.log('MICROPHONE MUTED', 'control', 'bg-warning');
    } else {
        room.localParticipant.audioTracks.forEach(function (audioTrack) {
            console.log("audioTrack-- "+audioTrack);
            audioTrack.enable();
        });
        microphone = true;
        $('#call-microphone').html('<span class="fa fa-microphone-slash"></span> ');
        console.log('MICROPHONE ON', 'control', 'bg-info');
    }
});

}