twilio / video-quickstart-js

A quickstart and code samples for Twilio Video JavaScript SDK. https://www.twilio.com/docs/video
Other
390 stars 336 forks source link

Calling `pause()` on video/audio tracks only works locally #129

Closed ghost closed 4 years ago

ghost commented 4 years ago

Hi there,

I'm trying to add functionality to my React app to mute your own microphone or disable the camera. I'm currently doing it by invoking these two methods:

const disableCamera = () => {
    room?.localParticipant.videoTracks.forEach((publication) => {
        const track = publication.track;
        track.isEnabled ? track.disable() : track.enable();
    });
};

const muteMicrophone = () => {
    room?.localParticipant.audioTracks.forEach((publication) => {
        const track = publication.track;
        track.isEnabled ? track.disable() : track.enable();
    });
};

Unfortunately, it only seems to disable the video/microphone locally and it continues to send the tracks, which leads to all other participants still being able see/hear you.

I'm not sure what I'm doing wrong. How can I make it so it disables the tracks both locally and remotely?

Looking forward to a response! Thanks so much.

ghost commented 4 years ago

Opened this in the wrong repo... my apologies. You can ignore it, thanks!