LocalScreenStream interface

extends ScreenStream  LOCAL

Your screen-share stream. Adds frame capture on top of ScreenStream. Access via room.localParticipant.screen after publishScreen(). No processor on screen share in v1 โ€” camera/mic processors don't apply to screen.

Blueprint

Members added on top of ScreenStream. Bundled audio is exposed via the nested .audio property when publishScreen({ audio: true }).

interface LocalScreenStream extends ScreenStream { // Bundled screen audio โ€” null unless publishScreen was called with { audio: true } readonly audio: LocalScreenAudioStream | null; // One-shot snapshot โ€” Base64 data URL (LOCAL only) captureFrame(opts?: { quality?: number; width?: number; height?: number; }): Promise<string>; // === Events fired === // 'ended' ({ timestamp }) โ€” browser "Stop sharing" / window closed // No setInputDevice โ€” getDisplayMedia picker chooses the source at publish time. // To change source: unpublish, then publishScreen() again. }
No setInputDevice. The screen source is chosen via the browser's getDisplayMedia picker at publish time. To change source, unpublish and re-publish โ€” the picker will prompt the user again.

Properties (added)

audio

The bundled screen-audio stream. Non-null only when you called publishScreen with { audio: true } AND the browser/source actually delivered system audio (Chrome's tab-share is the most common case).

readonly audio: LocalScreenAudioStream | null
Example โ€” render screen share with bundled audio
const stream = await me.publishScreen({ audio: true });
stream.attach(document.querySelector('#self-screen'));
if (stream.audio) {
  console.log('Bundled screen audio is publishing');
}

Methods (added)

Plus inherited from VideoStream via ScreenStream: attach / detach, createElement, getStats, getMediaStreamTrack.

No screen processor in v1. Camera and microphone processors are configured via VideoSDK.applyVideoProcessor() / applyAudioProcessor(). Screen share intentionally has no equivalent โ€” screen pixels rarely benefit from per-frame transformation. May be added in a future release if real demand emerges.

captureFrame async LOCAL ONLY

One-shot snapshot of the current screen frame as a Base64-encoded data URL. Useful for "save annotated screenshot" features or sharing the current view to chat.

captureFrame(opts?: { quality?: number; width?: number; height?: number }): Promise<string>
Parameters
  • opts.quality โ€” 0..1 for JPEG only, default 0.9.
  • opts.width / opts.height โ€” optional override; defaults to the source frame size.
Returns

Data URL string: "data:image/png;base64,..."

Example โ€” annotate-and-share screenshot
const dataUrl = await me.screen.captureFrame();
const annotated = await drawAnnotationsOver(dataUrl);
shareToChat(annotated);
No stop() on LocalScreenStream. Screen share has no pre-call lifecycle (no createScreenStream โ€” the screen source is acquired at publishScreen() time). To end a screen share, call me.unpublishScreen() โ€” full teardown (unpublish + release source). The browser's native "Stop sharing" banner triggers the same teardown automatically (SDK fires 'ended' and unpublishes).

Events

There are no publish/unpublish events on LocalParticipant โ€” the publishScreen Promise delivers the stream directly.

EventPayloadWhen
ended{ timestamp: number }Screen source ended โ€” user clicked browser's "Stop sharing" UI, or the captured window/tab was closed.

The ended event is particularly relevant here โ€” apps should listen for it and update UI accordingly.

Routing transitions and decoder-side observations live on RemoteScreenStream via the merged streamState + state-changed event (active / paused / frozen / stuck / ended). They describe the receive-side decoder, not the local capture pipeline.
Example โ€” handle "Stop sharing" from browser UI
await me.publishScreen({ audio: true });
const stream = me.screen;

stream.on('ended', () => {
  // User clicked browser's stop-sharing banner
  updateUI({ sharingScreen: false });
});

See also: ScreenStream VideoStream LocalParticipant.publishScreen RemoteScreenStream