Layouts & Participant Views
Layouts & Participant Views
Layouts & Participant Views
For multi-party video rooms, the SignalWire platform composes every
participant’s camera into a single mixed video stream —
call.remoteStream$ emits that stream. A
layout is the rule the server uses to composite it: grid,
presenter + thumbnails, picture-in-picture, etc. Each room has a
list of layouts the server allows; clients pick one, optionally pin
who goes in which slot, and read back where everyone ended up.
The server composes the video. The client picks the composition and draws overlays (name tags, mute icons, click targets) on top using percentage-based layer coordinates.
Wire a picker to layouts$ (available options), layout$
(current selection), and setLayout() (mutator):
The available layout names are server-defined — they depend on the
room’s configuration. setLayout rejects with InvalidParams if you
pass a name that isn’t in layouts$, so either bind from the picker
options (as above) or validate up front.
The empty {} second argument means “let the server place
participants automatically.” To pin specific members into specific
slots:
Slot names (reserved-0, reserved-1, auto, standard-0, …) are
defined per-layout — see VideoPosition. Members not in the map
are auto-placed. The local user can request their own position too
with call.self.setPosition(), gated
by capabilities.self.position.
Attach the mixed stream to a single <video> element:
The stream already contains every participant arranged by the
current layout — don’t render per-participant <video> tags.
Overlays (name tags, mute icons, click hotspots, speaking borders)
go on top of the single video. layoutLayers$ emits
per-participant boxes with percentage coordinates (0–100)
relative to the room canvas, so overlays scale with the video
element regardless of resolution.
See LayoutLayer for the full layer shape (z-index, visibility,
reservation slot, etc.).
For per-tile UI, each Participant has its own
position$ scoped to that member —
simpler than filtering layoutLayers$ on every emission.
layout$ and layoutLayers$ re-emit whenever the server
re-composites: setLayout calls, members joining or leaving under
auto-layout, the server promoting a raised hand. Subscriptions stay
live; overlays follow automatically.
Hide the picker / position controls when the capability is false. See Capabilities.
layouts$ · layout$ · layoutLayers$ — what to subscribe tosetLayout() — switch the composition / pin slotsParticipant.position$ · Participant.setPosition() — per-member positionLayoutLayer · VideoPosition — data shapesSelfCapabilities.setLayout$ — capability gate