Skip to main content
Version: 1.2

Presentation - Screen share

Presentation means sharing a screen of a user (presenter) to show a material such as slides to the other call peers. This page describes how to use the presentation function based on the call type.

FunctionSupported call typeMinimum SDK version
Sending (screen capture and transmission)1-to-1 call, group call (conference)Android: 1.2
iOS: 1-to-1 call 0.8, group call 0.9
Receiving (rendering a peer's screen share)1-to-1 call, group call (conference)1-to-1 call: 0.8
Group call: 0.9
Note
  • As of version 1.2, screen share capturing and transmission are supported on both Android and iOS, but the two platforms use different mechanisms:
    • On Android, PlanetKit captures the screen itself. The application calls startMyScreenShare(), and PlanetKit requests the system screen capture consent and runs the capture in a media projection foreground service.
    • On iOS, the application captures the screen through a Broadcast Upload Extension and sends the stream to PlanetKit over NWConnection, using the ScreenShareKey set when the call starts.
  • Receiving a peer's screen share is supported on both platforms, and the flow is the same on both.
  • PlanetKit uses HD resolution in its presentation feature, so it can provide an optimized service when the client's network condition is above the recommended bandwidth.

Android

Prerequisites

Screen capture runs in a foreground service that PlanetKit starts for you, but the service and its permissions must be declared by your application. Add the following to your app's AndroidManifest.xml:

<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_MEDIA_PROJECTION" />

<application ...>
<service
android:name="com.example.planet_kit_flutter.screenshare.PlanetKitScreenShareService"
android:foregroundServiceType="mediaProjection"
android:exported="false" />
</application>

PlanetKit creates the notification channel and posts the ongoing "Screen sharing" notification itself, so no additional notification setup is required.

Note

You do not need to define a port number or tokens, and you do not need to call setScreenShareKey(). Those are used only by the iOS broadcast extension flow.

1-to-1 call

Starting a presentation​

The following diagram shows the flow for starting a presentation in 1-to-1 calls on Android.

Android 1-to-1 call screen share start sequence diagram

Stopping a presentation

The following diagram shows the flow for stopping a presentation in 1-to-1 calls on Android.

Android 1-to-1 call screen share stop sequence diagram

Group call

Starting a presentation​

The following diagram shows the flow for starting a presentation in group calls on Android.

Android Group call screen share start sequence diagram

Stopping a presentation

The following diagram shows the flow for stopping a presentation in group calls on Android.

Android Group call screen share stop sequence diagram

When screen share stops automatically

In addition to user-initiated stops, PlanetKit for Android stops screen share if the screen capturer reports an error. Peers are notified through onPeerScreenShareStopped in 1-to-1 calls, or onScreenShareUpdate with state=disabled in group calls, and the sender is notified through PlanetKitMyMediaStatusHandler.onScreenShareStateUpdate with state=disabled.

Because a screen share can stop without your application asking for it, update your UI based on onScreenShareStateUpdate rather than based on the return value of startMyScreenShare() alone.

iOS

Prerequisites

  • The application must implement Broadcast Upload Extension or equivalents to capture the screen.
    • To implement Broadcast Upload Extension, in Xcode, add a new Target to your project, select "Broadcast Upload Extension" template, and activate the extension.
  • Define a port number, a reception token, and a transmission token that will be used for screen share stream transmission.

1-to-1 call

Starting a presentation​

The following diagram shows the flow for starting a presentation in 1-to-1 calls on iOS.

iOS 1-to-1 call screen share start sequence diagram

Stopping a presentation

The following diagram shows the flow for stopping a presentation in 1-to-1 calls on iOS.

iOS 1-to-1 call screen share stop sequence diagram

Group call

Starting a presentation​

The following diagram shows the flow for starting a presentation in group calls on iOS.

iOS Group call screen share start sequence diagram

Stopping a presentation

The following diagram shows the flow for stopping a presentation in group calls on iOS.

iOS Group call screen share stop sequence diagram

APIs related to the presentation function are as follows.

1-to-1 call

Methods

Events

Group call

Methods

Events