import { Meta } from '@storybook/blocks';

<Meta title="SDK Hooks/useAttendeeStatus" />

# useAttendeeStatus

The `useAttendeeStatus` hook returns the mute, video enabled, content sharing, and signal strength state for a given attendee ID. You can use this state to then build out a roster to reflect each attendee's meeting state.

### Return Value

```javascript
{
  // Whether or not the user is sharing their local video
  videoEnabled: boolean;

  // Whether or not the user is content sharing
  sharingContent: boolean;

  // Whether or not the user is muted
  muted: boolean;

  // Available values are 0 (no signal), 0.5 (weak signal), or 1 (good signal)
  signalStrength: number;
}
```

## Importing

```javascript
import { useAttendeeStatus } from 'amazon-chime-sdk-component-library-react';
```

## Usage

The hook depends on the `AudioVideoProvider`. If you are using `MeetingProvider`, it is rendered by default.

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

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

const MyChild = () => {
  const {
    muted,
    videoEnabled,
    sharingContent,
    signalStrength
  } = useAttendeeStatus('chime-attendee-id-1234');

  return (
    <>
      <p> chime-attendee-id-1234 is {muted ? 'muted' : 'unmuted'} </p>
      <p>{videoEnabled ? 'Sharing local video' : 'Not sharing local video'}</p>
      <p>{sharingContent ? 'Sharing content' : 'Not sharing content'}</p>
      <p>signal strength: {signalStrength}</p>
    </>
  );
};
```

### Dependencies

- `AudioVideoProvider`
