Function AudioCard

AudioCard component displays an audio card with various controls, participant information, and a visual waveform.

This component renders an interactive card with customizable styles, an image, and control buttons for audio and video functionality. The waveform reacts to audio levels, and the component manages real-time states through parameters like audioDecibels, participant information, and coHost responsibilities.

import React from 'react';
import { AudioCard } from 'mediasfu-reactjs';

function App() {
const participant = { name: "John Doe", id: "123", muted: false, videoOn: true };
const parameters = {
audioDecibels: [{ name: "John Doe", averageLoudness: 128 }],
participants: [participant],
socket: {}, // Add actual socket instance here
coHostResponsibility: [],
roomName: "Main Room",
coHost: "Host123",
islevel: "1",
member: "member",
eventType: "meeting",
getUpdatedAllParams: () => parameters,
};

return (
<AudioCard
name="John Doe"
participant={participant}
parameters={parameters}
audioDecibels={parameters.audioDecibels[0]}
showControls={true}
showInfo={true}
controlsPosition="topLeft"
infoPosition="topRight"
backgroundColor="black"
barColor="red"
textColor="white"
imageSource="https://example.com/image.jpg"
roundedImage={true}
imageStyle={{ width: "100px", height: "100px" }}
customStyle={{ width: "200px", height: "200px" }}
controlUserMedia={() => console.log("Control media invoked")}
videoInfoComponent={<CustomVideoInfoComponent />}
videoControlsComponent={<CustomVideoControlsComponent />}
/>
);
}

export default App;

Properties

propTypes?: any

Ignored by React.

Only kept in types for backwards compatibility. Will be removed in a future major release.

displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.


const MyComponent: FC = () => {
return <div>Hello!</div>
}

MyComponent.displayName = 'MyAwesomeComponent'