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:
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 (false in swift). 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.
By default, scalable video is disabled for screen-sharing streams. You can enable scalable video for screen-sharing streams using the OTPublisherKitSettings.scalableScreenshare property. Note: scalable video for screen-sharing streams is a beta feature.
The Stream object contains a videoType
property. This can be set to one of the following values, defined in the OTStreamVideoType enum:
OTStreamVideoTypeCamera
— a standard video stream that uses a camera as the
video sourceOTStreamVideoTypeScreen
— a screen sharing video streamOTStreamVideoTypeCustom
— a stream published
by a web client using an HTML VideoTrack element as the video sourceYou 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 in Objective-C or Swift.