Kotlin

This app demonstrates how to use the Media Projection API as the source for screen-sharing video. We'll learn how to use the custom video capturer to capture the device's screen and publish it as a video stream.

Architecture Overview

  1. Vonage session – Connect and publish
  2. MediaProjection – System API to capture the screen (requires user consent)
  3. Foreground service – Screen capture runs in a mediaProjection foreground service
  4. Custom capturer – Extends BaseVideoCapturer, captures frames and feeds them to the publisher

Estimated completion time: 25 mins

Want to skip this tutorial? You can jump straight to the completed Kotlin client code in the ScreenSharing folder of our Android sample app repo on GitHub. The repo includes a README with full documentation on how to run and explore the project. This tutorial focuses on the Kotlin version of the Android sample app. For the Java version, check the Previous sample app repo.

Requirements

To complete this tutorial, you’ll need: