philnash/twilio-video-react-hooks

How to detect if the remote participant has muted his video or audio ?

Opened this issue · 3 comments

Hi there ,
i was asking if their is a way to detect if the remote participant has closed his video to show his name instead and detect if he mutes his audio too?
Thanks in advance.

You can do that by listening to the "disabled" event on a RemoteVideoTrack or RemoteAudioTrack. If the camera/mic is enabled again, the remote track will fire an "enabled" event too.

video controller not working on it. like mute and hide video.

@philnash please help me. my hide camera and mute work only for the local Participant not for the remote Participant.

 const handleAudioToggle = () => {
    room.localParticipant.audioTracks.forEach((track) => {
      if (track.track.isEnabled) {
        track.track.disable();
      } else {
        track.track.enable();
      }
      setToggleAudio(track.track.isEnabled);
    });
  };

  const handleVideoToggle = () => {
    room.localParticipant.videoTracks.forEach((track) => {
      if (track.track.isEnabled) {
        track.track.disable();
      } else {
        track.track.enable();
      }
      setToggleVideo(track.track.isEnabled);
    });
  };

here is my function.
when i console the room. not find any RemoteAudioTrack or RemoteVideoTrack .