Screen Sharing

Add screen sharing to your 1:1 and group calls. The DropOnAir SDKs handle the start/stop signaling so every participant's UI stays in sync; your app captures the screen and adds the resulting MediaStreamTrack to the existing WebRTC peer connection.

How it works

  1. User taps "Share screen" in your app.
  2. Your app calls the platform-specific capture API (navigator.mediaDevices.getDisplayMedia() on web, MediaProjection on Android, a ReplayKit broadcast extension on iOS).
  3. Your app adds the resulting track to the active RTCPeerConnection(s), triggering an SDP renegotiation handled by your existing call signaling.
  4. Your app calls client.startScreenShare(callId) (1:1) or client.startGroupScreenShare(callId, groupId) (group). The SDK emits a signaling frame; remote SDKs deliver a matching event so the receiving app can show the share UI.
  5. When the user stops, your app calls client.stopScreenShare(...) / client.stopGroupScreenShare(...). The track is removed; remote SDKs deliver a STOPPED event.

Single sharer per group call

Group calls enforce one concurrent sharer. If another participant already holds the slot when your app calls startGroupScreenShare, the SDK delivers a GROUP_CALL_SCREEN_SHARE_STOPPED event whose payload field carries the current holder's userId. Use that to roll back the optimistic share UI and show "X is already sharing".

When a sharer leaves the call, the platform broadcasts a STOPPED event to the remaining participants before they see PARTICIPANT_LEFT, so the screen-share UI tears down cleanly.

Example

async function shareMyScreen(callId, peerConnection) {
  const stream = await navigator.mediaDevices.getDisplayMedia({ video: true });
  const track  = stream.getVideoTracks()[0];
  peerConnection.addTrack(track, stream);
  client.startScreenShare(callId);
  track.onended = () => client.stopScreenShare(callId);
}

client.onCallEvent((evt) => {
  if (evt.type === 'CALL_SCREEN_SHARE_STARTED') showShareIndicator(evt.callId);
  if (evt.type === 'CALL_SCREEN_SHARE_STOPPED') hideShareIndicator(evt.callId);
});

Event reference

EventScopePayload
CALL_SCREEN_SHARE_STARTED1:1Optional app metadata
CALL_SCREEN_SHARE_STOPPED1:1Optional app metadata
GROUP_CALL_SCREEN_SHARE_STARTEDgroupSharer's userId
GROUP_CALL_SCREEN_SHARE_STOPPEDgroupHolder's userId (echo when slot taken)

Availability. Screen sharing is plan-controlled. See the pricing page for tiers, or your DropOnAir dashboard Subscription page to see what's enabled on your app.

Security. The screen track is a WebRTC media stream, end-to-end encrypted by DTLS-SRTP just like audio and video. The platform never sees the screen contents; it only relays the start/stop notification.

Requires SDK 0.6.0+ on JavaScript, Android, and iOS.