Screen sharing — Windows
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
- Determining the video type ("screen" or "camera") for a stream
- Subscribing to screen-sharing streams
Publishing a stream with a screen-sharing source
To use the device's screen, instead of a camera, as the video source, you will need to implement a custom video capturer.
Here is a simple example that defines a custom video capturer to implement screen sharing (using the screen instead of a camera as the video source):
Set the VideoSourceType property of the Publisher object to OpenTok.VideoSourceType.Screen. This flags the published stream as having a screen-sharing video source (instead of a camera).
By default, scalable video is disabled for screen-sharing streams. You can enable scalable video for screen-sharing streams using the Publisher.Builder.ScalableScreenshare property. Note: scalable video for screen-sharing streams is a beta feature.
Determining the video type ("screen" or "camera") for a stream
The Stream object contains a VideoSourceType property. This can be set to one of the following values, defined in the OpenTok.VideoSourceType enum:
Camera— a standard video stream that uses a camera as the video sourceScreen— a screen sharing video streamCustom— a stream published by a web client using an HTML VideoTrack element as the video source
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.