close search

Screen sharing — iOS

You can publish a stream that uses a video view of your screen (instead of a camera) as the source. A client connected to the session can subscribe to the stream (and view it), just as they would subscribe to a stream that uses a camera as the source.

This topic includes the following sections:

Publishing a stream with a screen-sharing source

To use the device's screen, instead of a camera, as the video source, use the PublisherKit class to use a custom video capturer. For a code sample, see the Screen-Sharing project in the samples directory of the SDK.

Set the OTPublisherKit.videoType property to OTPublisherKitVideoTypeScreen (defined in OTPublisherKitVideoType). This flags the published stream as having a screen-sharing video source (instead of a camera).

Before you publish a screen-sharing stream that uses the screen video type in a session that uses the OpenTok Media Server, you should set the OTPublisherKit.audioFallbackEnabled property to NO. This disables the audio-only fallback feature, so that the video does not drop out in subscribers. See The OpenTok Media Router and media modes.

Determining the video type ("screen" or "camera") for a stream

The Stream object contains a videoType property. This can be set to one of the following values, defined in the OTStreamVideoType enum:

Subscribing to screen-sharing streams

You can subscribe to a stream that uses a screen-sharing video source in the same way that you subscribe to a stream that uses a camera as the source. See Subscribing to streams.