Screen Capture - Android 6.x

Drag to rearrange sections
Rich Text Content

In this guide we'll use the Screen Capturer quickstart to demonstrate how to share your Android device application screen with other participants connected to a Room using the MediaProjection API.

If you are interested in capturing from an Android View in the View hierarchy instead of capturing from the device screen you can take a look at our custom video capturer example instead:

Using the Screen Capturer API

The ScreenCapturer class that ships with the Video Android SDK is used to provide video frames for a LocalVideoTrack from a device's screen. The frames are provided via the MediaProjection api. This capturer is only compatible with Build.VERSION_CODES.LOLLIPOP or higher.

Setup your app Manifest

Starting in Android 10, developers are required to specify a foreground service when using the MediaProjection API. Reference the following snippet from the quickstart example AndroidManifest.xml.

Initialize a Video View

Request screen capture permission from user

Get an instance of the MediaProjectionManager service. Call the createScreenCaptureIntent method in a new activity. This initiates a prompt dialog for the user to confirm screen projection.

Request Screen Capturer Permission

Start Screen capture when permission received

Initialize the ScreenCapturer class, after permission is received from the user. Create the LocalVideoTrack object and pass the ScreenCapturer object to pass the captured local video frames. Android phones Set the VideoView object to Visible . Call the addSink method on the LocalVideoTrack object. Pass the VideoView object to begin receiving the screen capture video.

Using the Screen Capturer Class

Found an error ? Open an issue on Github

Stuck on something? Can't find what you're looking for? Don't hesitate to reach out to us at and we'll happily give you a hand.

Drag to rearrange sections
Rich Text Content

Page Comments

No Comments

Add a New Comment:

You must be logged in to make comments on this page.