### Install Dependencies and Start Test Demo Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/integration/README.md Navigate to the test demo directory, install npm packages, and start the local development server. ```plaintext cd app/test-demo npm install npm run start ``` -------------------------------- ### Run Storybook Server Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/README.md Start the Storybook server locally to view component documentation and examples. ```bash npm start ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/README.md Clone the repository and install all necessary dependencies for local development. ```bash git clone https://github.com/aws/amazon-chime-sdk-component-library-react.git npm install ``` -------------------------------- ### Install Dependencies Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/src/components/introduction.mdx Install the component library and its peer dependencies using npm. ```sh npm install --save amazon-chime-sdk-component-library-react amazon-chime-sdk-js styled-components styled-system ``` -------------------------------- ### Start Meeting Session Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/src/providers/MeetingProvider/docs/MeetingManager.mdx Call the `start` method after `join` to enable audio and video transmission for attendees. This action initiates the meeting session. ```javascript () => Promise ``` -------------------------------- ### ControlBar Example with Buttons Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/src/components/ui/ControlBar/ControlBar.mdx Demonstrates how to configure and render a ControlBar with multiple ControlBarButtons, each with specific icons, onClick handlers, labels, and popover configurations. This example showcases common controls like mute, camera, dial, screen share, and hang up. ```jsx const [muted, setMuted] = useState(false); const [cameraActive, setCameraActive] = useState(false); const microphoneButtonProps = { icon: muted ? : , onClick: () => setMuted(!muted), label: 'Mute', }; const cameraButtonProps = { icon: cameraActive ? : , popOver: [ { onClick: () => console.log('camera popover option 1'), children: Some option text, }, { onClick: () => console.log('camera popover option 2'), children: More option text, }, ], onClick: () => setCameraActive(!cameraActive), label: 'Camera', }; const dialButtonProps = { icon: , onClick: () => console.log('Toggle dial pad'), label: 'Dial', }; const hangUpButtonProps = { icon: , onClick: () => console.log('End meeting'), label: 'End', }; const volumeButtonProps = { icon: , onClick: () => console.log('Volume button clicked'), popOver: [ { onClick: () => console.log('volume popover option 1'), children: Some option text, }, { onClick: () => console.log('volume popover option 2'), children: More option text, }, ], label: 'Volume', }; const laptopButtonProps = { icon: , onClick: () => console.log('Screen button clicked'), label: 'Screen', }; return ( ); ``` -------------------------------- ### Join and Leave Meeting with MeetingManager Source: https://context7.com/aws/amazon-chime-sdk-component-library-react/llms.txt Use `useMeetingManager` to get the `MeetingManager` instance. Call `join()` to initialize devices and `start()` to connect the WebRTC session. `leave()` tears down the session. Fetch meeting credentials from your backend before joining. ```tsx import React from 'react'; import { useMeetingManager, DeviceLabels, MeetingStatus, } from 'amazon-chime-sdk-component-library-react'; import { MeetingSessionConfiguration } from 'amazon-chime-sdk-js'; const JoinButton: React.FC = () => { const meetingManager = useMeetingManager(); const handleJoin = async () => { // Fetch meeting/attendee credentials from your backend const res = await fetch('/api/join', { method: 'POST' }); const { Meeting, Attendee } = await res.json(); const config = new MeetingSessionConfiguration(Meeting, Attendee); try { // join() initialises devices; skipDeviceSelection avoids the default // auto-selection when you want full control await meetingManager.join(config, { deviceLabels: DeviceLabels.AudioAndVideo, // requests mic + camera enableWebAudio: true, // required for VoiceFocus skipDeviceSelection: false, }); // Provide a callback so roster cells show attendee names meetingManager.getAttendee = async (chimeAttendeeId, externalUserId) => { const r = await fetch(`/api/attendee?id=${chimeAttendeeId}`); return r.json(); // must have { name: string } }; await meetingManager.start(); // connects the WebRTC session } catch (err) { console.error('Failed to join meeting', err); } }; const handleLeave = async () => { await meetingManager.leave(); }; return ( <> ); }; ``` -------------------------------- ### Basic Select Example Source: https://github.com/aws/amazon-chime-sdk-component-library-react/blob/main/src/components/ui/Select/Select.mdx Demonstrates a basic Select component with a list of fruit options. Ensure you have the necessary ThemeProvider and GlobalStyles for styling. ```jsx