Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal
Developer Documentation moved on August 7, 2026. Future updates are available only at → https://developer.vonage.com/en/opentok/overview

Screen sharing — Android

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 activity in the samples directory of the SDK.

Call the setPublisherVideoType(PublisherKit.PublisherKitVideoType type) property of the Publisher object and pass in PublisherKit.PublisherKitVideoTypePublisherKitVideoTypeScreen. 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 routed session, you should call the setAudioFallbackEnabled(boolean enabled) method for the PublisherKit object and pass in false. 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 PublisherKit.Builder.scalableScreenshare() method.

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 Stream.StreamVideoType 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.