@fortawesome/free-solid-svg-icons#faVolumeMute TypeScript Examples

The following examples show how to use @fortawesome/free-solid-svg-icons#faVolumeMute. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AudioOutputControl.tsx    From amazon-chime-sdk-smart-video-sending-demo with Apache License 2.0 6 votes vote down vote up
AudioOutputControl: React.FC = () => {
  const audioVideo = useAudioVideo();
  const [isAudioOn, setIsAudioOn] = useState(true);
  const audioRef = useRef<HTMLAudioElement>(null);
  
  useEffect(() => {
    if (!audioVideo) {
      return;
    }

    if (audioRef.current) {
      audioVideo.bindAudioElement(audioRef.current);
    }
    return () => {
      audioVideo.unbindAudioElement();
    };
  }, [audioRef, audioVideo]);

  const toggleAudio = (): void => {
    if (!audioRef.current) {
      return;
    }
    setIsAudioOn(!isAudioOn);
    if (isAudioOn) {
      audioVideo?.unbindAudioElement();
    } else {
      audioVideo?.bindAudioElement(audioRef.current);
    }
  }

  return (
    <>
      <ButtonGroup>
        <IconButton icon={isAudioOn ? faVolumeUp : faVolumeMute} onClick={toggleAudio} />
      </ButtonGroup>
      <audio ref={audioRef} style={{ display: 'none' }} />
    </>
  );
}
Example #2
Source File: StageView.tsx    From livekit-react with Apache License 2.0 5 votes vote down vote up
StageView = (stageProps: StageProps) => {
  const isMobile = useMediaQuery({ query: '(max-width: 800px)' });
  const { room, participants } = stageProps.roomState;
  const context = useContext(DisplayContext);

  let mainElement: ReactElement;
  if (isMobile) {
    mainElement = <MobileStage {...stageProps} />;
  } else {
    // find first participant with screen shared
    let screenTrack: VideoTrack | undefined;
    participants.forEach((p) => {
      if (screenTrack) {
        return;
      }
      const track = p.getTrack(Track.Source.ScreenShare);
      if (track?.isSubscribed && track.videoTrack) {
        screenTrack = track.videoTrack;
      }
    });

    if (context.stageLayout === 'grid' && screenTrack === undefined) {
      mainElement = <GridStage {...stageProps} />;
    } else {
      mainElement = <SpeakerStage {...stageProps} />;
    }
  }

  return (
    <div className={styles.container}>
      {mainElement}
      {stageProps.roomState.audioTracks.map((track) => (
        <AudioRenderer key={track.sid} track={track} isLocal={false} />
      ))}

      {room?.canPlaybackAudio === false && (
        <div className={styles.overlay}>
          <button
            className={styles.unmuteButton}
            onClick={() => {
              room.startAudio();
            }}
          >
            <FontAwesomeIcon className={styles.icon} size="1x" icon={faVolumeMute} />
            Click to Unmute
          </button>
        </div>
      )}
    </div>
  );
}