Function ScreenboardModal

ScreenboardModal component provides a modal interface for screen annotation. It handles the display and management of screen sharing and annotation streams.

import { ScreenboardModal } from 'mediasfu-reactjs';

// Define the parameters and functionality for screen sharing and annotation
const parameters = {
localStreamScreen: new MediaStream(),
shared: true,
hostLabel: "Host Name",
annotateScreenStream: true,
processedScreenStream: null,
mainScreenCanvas: null,
canvasScreenboard: null,
transportCreated: false,
screenProducer: null,
updateLocalStreamScreen: (stream) => console.log("Local Stream:", stream),
updateProcessedScreenStream: (stream) => console.log("Processed Stream:", stream),
updateMainScreenCanvas: (canvas) => console.log("Main Screen Canvas:", canvas),
sleep: ({ ms }) => new Promise((resolve) => setTimeout(resolve, ms)),
createSendTransport: async (options) => console.log("Create Transport:", options),
disconnectSendTransportScreen: async (options) => console.log("Disconnect Transport:", options),
connectSendTransportScreen: async (options) => console.log("Connect Transport:", options),
stopShareScreen: async (options) => console.log("Stop Share Screen:", options),
prepopulateUserMedia: async (options) => console.log("Prepopulate Media:", options),
getUpdatedAllParams: () => ({
filteredRequestList: [],
}),
};

const isVisible = true;
const handleClose = () => console.log("Modal closed");

// Render the ScreenboardModal component
<ScreenboardModal
parameters={parameters}
isVisible={isVisible}
onClose={handleClose}
position="topRight"
backgroundColor="#83c0e9"
/>

Properties

propTypes?: WeakValidationMap<ScreenboardModalOptions>

Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.

We recommend using TypeScript instead of checking prop types at runtime.

contextTypes?: ValidationMap<any>

Lets you specify which legacy context is consumed by this component.

defaultProps?: Partial<ScreenboardModalOptions>

Used to define default values for the props accepted by the component.

type Props = { name?: string }

const MyComponent: FC<Props> = (props) => {
return <div>{props.name}</div>
}

MyComponent.defaultProps = {
name: 'John Doe'
}
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'