Skip to main content
useScreenShare(params?): Object useScreenShare can also be used to set up optional callbacks for the local-screen-share-started and local-screen-share-stopped events.

Parameters (optional)

An object with the following properties:
onLocalScreenShareStarted
Function
Callback for the local-screen-share-started event.
onLocalScreenShareStopped
Function
Callback for the local-screen-share-stopped event.

Return value

An object with the following properties:
isSharingScreen
boolean
Indicates whether the local user is sharing a screen.
screens
Array
Array of screen share objects.
startScreenShare
Function
stopScreenShare
Function
{
  "isSharingScreen": false,
  "screens": [{
    "audio": <Object>,
    "local": true,
    "screen_id": "25bfe2e4-3a3d-4c6f-b877-392ce7c998e4-screen",
    "session_id": "25bfe2e4-3a3d-4c6f-b877-392ce7c998e4",
    "video": <Object>,
  }],
  "startScreenShare": <Function>,
  "stopScreenShare": <Function>,
}

Example

import { useScreenShare } from '@daily-co/daily-react';

export const UseScreenShareDemo = () => {
  const state = useScreenShare();

  return <div>Sharing Screen: {state?.isSharingScreen}</div>;
};

See also