Skip to main content

ScreenSharingView

The ScreenSharingView is a component that allows you to display a video of a screen sharing session. This component is designed for use in video conferencing and other similar applications where users are able to share their entire screens or specific windows.

The screensharing behaviour is enabled by default in the SDK, along with a standard UI that contains the screen sharing track and a list of participants.

The CallParticipant model contains the screensharing info. It has a property called isScreensharing, to indicate whether a participant is sharing their screen. Additionally, you can access the screenshareTrack (if available) from this model.

Only users with the screenshare capability can start screensharing sessions. At the moment, this is only possible from the React SDK. Users can request permission to screenshare, by calling the Call's request(permissions: [Permission]) method and passing the screenshare option.

Usage

Here's an example how to create a ScreenSharingView:

ScreenSharingView(
viewModel: viewModel,
screenSharing: screensharingSession,
availableFrame: availableFrame
)

In this method, the following parameters are provided:

  • viewModel - the CallViewModel used in the call.
  • screensharingSession - The current screen sharing session, that contains information about the track, as well as the participant that is sharing.
  • availableFrame - the available frame to layout the rendering view.

Customization

If you want to implement your own UI when there's screen sharing in progress, you need to implement the makeScreenSharingView method in the ViewFactory. Here's an example implementation:

public func makeScreenSharingView(
viewModel: CallViewModel,
screensharingSession: ScreenSharingSession,
availableFrame: CGRect
) -> some View {
CustomScreenSharingView(
viewModel: viewModel,
screenSharing: screensharingSession,
availableFrame: availableFrame
)
}

Similarly to above, the following parameters are provided:

  • viewModel - the CallViewModel used in the call.
  • screensharingSession - The current screen sharing session, that contains information about the track, as well as the participant that is sharing.
  • availableFrame - the available frame to layout the rendering view.

Did you find this page helpful?