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
- Vonage session – Connect and publish
- MediaProjection – System API to capture the screen (requires user consent)
- Foreground service – Screen capture runs in a
mediaProjectionforeground service - 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:
- A valid Vonage Video API account — if you don’t have one, you can sign up for a free trial
- Android Studio
Screen sharing
Learn how to implement tha screensharing capability using the Vonage Video API platform.
手順
1
Introduction2
Getting Started3
Creating a new project4
Adding the Android SDK5
Setting up authentication6
Requesting permissions7
Implement the Custom Capturer8
Starting the capture9
Initializing Session10
Running the app11
Conclusion