montassar attia
montassar attia

Reputation: 28

AWS Chime turn on or off the local audio output

0

Hi guys i'm trying to create a button that disables my microphone in ws-chime,but not working with me when turn isAudioOn to false nothing seems to happen,the other user keeps listening to my sound

import React from 'react';
import {
  MeetingProvider,
  useLocalAudioOutput
} from 'amazon-chime-sdk-component-library-react';

const App = () => (
  <MeetingProvider>
    <MyChild />
  </MeetingProvider>
);

const MyChild = () => {
  const { isAudioOn, toggleAudio } = useLocalAudioOutput();

  return (
    <div>
      <div>
        {isAudioOn
          ? 'Meeting audio output is on'
          : 'Meeting audio output is off'}
      </div>
      <button onClick={toggleAudio}>Toggle Local Audio Output</button>
    </div>
  );
};

Upvotes: 2

Views: 718

Answers (1)

Court Schuett
Court Schuett

Reputation: 216

If you're already using React, you can use the AudioInputControl Component

https://aws.github.io/amazon-chime-sdk-component-library-react/?path=/story/sdk-components-meetingcontrols-audioinputcontrol--page

Upvotes: 0

Related Questions