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:

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:

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

screens properties

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