useScreenShare
useScreenShare(params?): Object
Returns a list of running screen shares and their states, along with helper methods that wrap daily-js screen share events.
useScreenShare can also be used to set up optional callbacks for the local-screen-share-started and local-screen-share-stopped events.
Params (optional)
An object with the following properties:
| Parameter | Required | Type | Description |
|---|---|---|---|
onError | Function | Callback for the nonfatal-error event with type 'screen-share-error' | |
onLocalScreenShareStarted | Function | Callback for the local-screen-share-started event | |
onLocalScreenShareStopped | Function | Callback for the local-screen-share-stopped event |
Return type
An object with the following properties:
| Name | Type | Description |
|---|---|---|
isSharingScreen | boolean | Indicates whether the local user is sharing a screen |
screens | Array | Array of screens. See screens object properties |
startScreenShare | Function | See startScreenShare() |
stopScreenShare | Function | See stopScreenShare() |
screens properties
| Name | Type | Description |
|---|---|---|
audio | Object | Track state for associated screenAudio, see tracks properties for details |
local | boolean | Indicates if this is a local screen share |
screen_id | string | Unique identifier for the screen |
session_id | string | Unique identifier for the participant screen sharing |
video | Object | Track state for associated screenVideo, see tracks properties for details |