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:

ParameterRequiredTypeDescription
onErrorFunctionCallback for the nonfatal-error event with type 'screen-share-error'
onLocalScreenShareStartedFunctionCallback for the local-screen-share-started event
onLocalScreenShareStoppedFunctionCallback for the local-screen-share-stopped event

Return type

An object with the following properties:

NameTypeDescription
isSharingScreenbooleanIndicates whether the local user is sharing a screen
screensArrayArray of screens. See screens object properties
startScreenShareFunctionSee startScreenShare()
stopScreenShareFunctionSee stopScreenShare()

screens properties

NameTypeDescription
audioObjectTrack state for associated screenAudio, see tracks properties for details
localbooleanIndicates if this is a local screen share
screen_idstringUnique identifier for the screen
session_idstringUnique identifier for the participant screen sharing
videoObjectTrack state for associated screenVideo, see tracks properties for details

Sample code