Skip to content

fix(layout): show screenshare in recordings without layout.xml events - #366

Merged
antobinary merged 1 commit into
bigbluebutton:developfrom
germanocaumo:fix-screenshare-old-recs
Aug 5, 2026
Merged

antobinary merged 1 commit into
bigbluebutton:developfrom
germanocaumo:fix-screenshare-old-recs

Conversation

@germanocaumo

Copy link
Copy Markdown
Contributor

Fixes #363.

Problem

Recordings whose layout.xml has no show_screenshare event play back with a blank content area for the whole duration of every screenshare — the layer stays display: none while the presentation renders the transparent presentation/deskshare.png placeholder.

That means recordings processed before BBB 3.0.2, when process_swap_events started writing layout.xml: all 2.x recordings, plus 3.0.0 and 3.0.1. From 3.0.2 on the file is always populated — starting a screenshare records a SetScreenshareAsContentEvent by itself — so newer recordings are fine. The boundary is 3.0.2, not 3.0.27 as the issue title suggests.

Cause

#331 replaced isShowScreenshareAsContent with getLayoutEvent and dropped its fallback:

if (isEmpty(data)) return true;   // ← removed

A missing event now resolves to showScreenshare: false.

Fix

New getLayoutSwap resolves showPresentation and showScreenshare from the most recent event carrying each property, falling back when there is none: presentation visible, screenshare shown while it is being shared — the same default create_layout_edl uses for old recordings.

Both hooks also derive their initial state from timestamp 0. That part is hardening, not the fix.

Note

@GhaziTriki's #365 fixes the same thing with an equivalent fallback; this adds unit tests and per-property resolution. Happy to fold it in either direction.

A recording whose layout.xml carries no show_screenshare event at or before a
screenshare plays back with a blank content area for the whole duration of that
screenshare: the screenshare layer stays display: none while the presentation
renders the transparent presentation/deskshare.png placeholder.

layout.xml was introduced by process_swap_events in BBB 3.0.2, so recordings
processed by anything earlier — every 2.x recording, plus 3.0.0 and 3.0.1 —
have no such file, and every screenshare in them is affected.

From 3.0.2 on, starting a screenshare records a SetScreenshareAsContentEvent by
itself: screenshareAsContent starts out false and the first share flips it to
true, so no quick swap is needed. Those recordings carry an event at or before
the screenshare and are unaffected. The event and the file arrived in the same
commit, so 3.0.2 is an exact boundary. 3.0.27 later replaced process_swap_events
with get_layout_events, which seeds a complete layout state at timestamp 0.

bigbluebutton#331 replaced isShowScreenshareAsContent with getLayoutEvent and dropped its
`if (isEmpty(data)) return true` fallback, so a missing event now resolves to
showScreenshare: false instead of falling back to the screenshare state.

validators.js:
- Add getLayoutSwap, resolving showPresentation and showScreenshare from the
  most recent event carrying each property. When a property has no event, fall
  back to the behaviour these recordings were played back with: the
  presentation is visible and the screenshare is the content while it is being
  shared
- Forward the property argument of getMostRecentEvent through getLayoutEvent.
  It has been accepted but unused since bigbluebutton#331; each layout property changes
  independently, and pre-3.0.27 files carry show_screenshare only, so reading
  both from a single most recent event would let an event that only changes the
  presentation reset the screenshare state
- Use Object.hasOwn rather than hasProperty in that filter. A missing property
  is the expected case here, and hasProperty logs a warning on every miss,
  which would be emitted at the time update rate

hooks/index.js:
- Derive the initial state of useCurrentContent and useLayoutSwap from timestamp
  0. This is hardening, not part of the fix above: the first render otherwise
  reports the presentation as the content even for a recording that starts on a
  screenshare, and only corrects itself on the first time update. Verified that
  it is not the cause of the blank layer — video.js recovers when its container
  is unhidden, which is why <Screenshare> is kept mounted under display: none
  rather than conditionally rendered

Fixes bigbluebutton#363
@antobinary
antobinary merged commit 68adb57 into bigbluebutton:develop Aug 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Playback starting with screenshare layer broken in 3.0.27

2 participants