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 }).
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).
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.
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.
opts.qualityโ0..1for JPEG only, default0.9.opts.width/opts.heightโ optional override; defaults to the source frame size.
Data URL string: "data:image/png;base64,..."
const dataUrl = await me.screen.captureFrame();
const annotated = await drawAnnotationsOver(dataUrl);
shareToChat(annotated);
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.
| Event | Payload | When |
|---|---|---|
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.
streamState + state-changed event (active / paused / frozen / stuck / ended). They describe the receive-side decoder, not the local capture pipeline.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