Skip to content

feat(screnshare): add ParticipantStatusChange event for screen sharing, + - #23326

Merged
antobinary merged 2 commits into
bigbluebutton:v3.0.x-releasefrom
prlanzarin:u30/feat/screenshare-participant-status-change
Jun 4, 2025
Merged

antobinary merged 2 commits into
bigbluebutton:v3.0.x-releasefrom
prlanzarin:u30/feat/screenshare-participant-status-change

Conversation

@prlanzarin

@prlanzarin prlanzarin commented Jun 4, 2025 •

Copy link
Copy Markdown
Member

What does this PR do?

  • feat(screnshare): add ParticipantStatusChange event for screen sharing
    • Screen sharing only generates RAP events during capture.
      For meetings with record=false or recordFullDurationMedia=false, screen sharing
      sessions are not registered in Redis/events.xml if they occur outside the
      capture window.
    • It has been requested that broadcast events should be registered as well
      for analytics purposes - irrespective of capture status.
    • Add ParticipantStatusChange events on screenshare broadcast start/stop.
      The event payload follows the same pattern as the existing ones for
      cameras:
      • status: hasScreenShare
      • value: ${true|false},stream=${streamId}
  • build(bbb-webrtc-sfu): v2.19.0-beta.1
    • feat(livekit): token gen for breakout audio-only transfers
    • feat(screenshare): add userId to screenshare RPCs

Closes Issue(s)

#23325

Screen sharing only generates RAP events during capture.
For meetings with record=false or recordFullDurationMedia=false, screen sharing
sessions are not registered in Redis/events.xml if they occur outside the
capture window.

It has been requested that broadcast events should be registered as well
for analytics purposes - irrespective or capture status.

Add ParticipantStatusChange events on screenshare broadcast start/stop.
The event payload follow the same pattern as the existing ones for
cameras:
  - status: `hasScreenShare`
  - value: `${true|false},stream=${streamId}`
v2.19.0-beta.1
---
* feat(livekit): token gen for breakout audio-only transfers
* feat(screenshare): add userId to screenshare RPCs
@prlanzarin prlanzarin added this to the Release 3.0 milestone Jun 4, 2025
@coderabbitai

coderabbitai Bot commented Jun 4, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

This set of changes introduces a userId field to the screenshare RTMP broadcast workflow in the application. The ScreenshareModel now tracks the userId of the user initiating a screenshare session, with new getter and setter methods. All related message case classes for starting and stopping screenshare RTMP broadcasts are updated to include this userId. Message builders and event handlers are refactored to pass and handle the new userId parameter. The RedisRecorderActor now processes new event types for screenshare RTMP start/stop events. Additionally, a deployment script is updated to use a newer branch of the bbb-webrtc-sfu component.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ScreenshareApp
    participant ScreenshareModel
    participant MsgBuilder
    participant EventHandler
    participant RedisRecorder

    User->>ScreenshareApp: Initiate screenshare (with userId)
    ScreenshareApp->>ScreenshareModel: setUserId(userId)
    ScreenshareApp->>MsgBuilder: buildStartScreenshareMsg(..., userId)
    MsgBuilder->>EventHandler: ScreenshareRtmpBroadcastStartedEvtMsg(..., userId)
    EventHandler->>RedisRecorder: handleScreenshareRtmpBroadcastStartedEvtMsg(..., userId)
    RedisRecorder->>RedisRecorder: handleUserStatusChange("hasScreenShare", "true,stream=...")

    User->>ScreenshareApp: Stop screenshare
    ScreenshareApp->>ScreenshareModel: getUserId()
    ScreenshareApp->>MsgBuilder: buildStopScreenshareMsg(..., userId)
    MsgBuilder->>EventHandler: ScreenshareRtmpBroadcastStoppedEvtMsg(..., userId)
    EventHandler->>RedisRecorder: handleScreenshareRtmpBroadcastStoppedEvtMsg(..., userId)
    RedisRecorder->>RedisRecorder: handleUserStatusChange("hasScreenShare", "false,stream=...")
Loading

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3a2ed1 and 6149640.

📒 Files selected for processing (8)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ScreenshareModel.scala (3 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/screenshare/GetScreenshareStatusReqMsgHdlr.scala (1 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/screenshare/ScreenshareApp2x.scala (2 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/screenshare/ScreenshareRtmpBroadcastStartedVoiceConfEvtMsgHdlr.scala (4 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala (2 hunks)
  • akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala (2 hunks)
  • bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala (5 hunks)
  • bbb-webrtc-sfu.placeholder.sh (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala (1)
bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala (6)
  • ScreenshareRtmpBroadcastStoppedEvtMsg (50-50)
  • ScreenshareRtmpBroadcastStoppedEvtMsg (51-55)
  • ScreenshareRtmpBroadcastStoppedEvtMsgBody (56-58)
  • ScreenBroadcastStopSysMsg (124-124)
  • ScreenBroadcastStopSysMsg (125-128)
  • ScreenBroadcastStopSysMsgBody (129-134)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: install-and-run-bbb-tests (8)
  • GitHub Check: install-and-run-bbb-tests (7)
  • GitHub Check: install-and-run-bbb-tests (6)
  • GitHub Check: install-and-run-bbb-tests (5)
  • GitHub Check: install-and-run-bbb-tests (4)
  • GitHub Check: install-and-run-bbb-tests (3)
  • GitHub Check: install-and-run-bbb-tests (2)
  • GitHub Check: install-and-run-bbb-tests (1)
  • GitHub Check: install-and-run-plugin-tests
🔇 Additional comments (25)
bbb-webrtc-sfu.placeholder.sh (1)

3-3: LGTM: Version bump aligns with PR objectives.

The branch update to v2.19.0-beta.1 is consistent with the PR summary which mentions updating the bbb-webrtc-sfu component to this version.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/screenshare/GetScreenshareStatusReqMsgHdlr.scala (2)

24-24: Good addition: Retrieving userId for event tracking.

The retrieval of ownerUserId from the ScreenshareModel follows the existing pattern and is necessary for enhanced analytics as described in the PR objectives.


32-33: LGTM: Consistent parameter addition.

The ownerUserId parameter is correctly added to the ScreenshareRtmpBroadcastStartedEvtMsgBody constructor, maintaining consistency with the enhanced event payload pattern.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/ScreenshareModel.scala (3)

7-7: Good practice: Including userId in reset functionality.

The userId field is properly reset to an empty string in resetDesktopSharingParams, ensuring clean state management when screenshare sessions end.


19-25: LGTM: Well-structured accessor methods.

The getUserId and setUserId methods follow the existing pattern in the companion object and provide consistent access to the userId field.


113-113: Good implementation: Proper field initialization.

The private userId field is correctly initialized to an empty string, following Scala best practices and avoiding potential null pointer issues.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/screenshare/ScreenshareApp2x.scala (3)

16-16: LGTM: Adding userId to stop broadcast message.

The inclusion of getUserId in the buildScreenBroadcastStopSysMsg call ensures consistent userId tracking across screenshare start and stop events.


26-33: Excellent refactoring: Extracting variables before reset.

The extraction of ScreenshareModel values into local variables improves code readability and ensures data is captured before resetDesktopSharingParams clears the model state. This is a smart optimization that prevents repeated getter calls and potential race conditions.


38-44: Good use of extracted variables.

Using the extracted variables in the buildStopScreenshareRtmpBroadcastEvtMsg call is cleaner and more efficient than the previous approach of calling getters directly in the method parameters.

akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/screenshare/ScreenshareRtmpBroadcastStartedVoiceConfEvtMsgHdlr.scala (4)

16-17: LGTM: Method signature updated correctly for userId tracking.

The broadcastEvent method signature correctly adds the userId parameter, maintaining consistency with the overall pattern of tracking user identifiers for screenshare events.


29-30: LGTM: Event body construction includes userId parameter.

The ScreenshareRtmpBroadcastStartedEvtMsgBody construction correctly includes the userId parameter, ensuring the user identifier is propagated to clients.


62-62: LGTM: User ID properly stored in screenshare model.

The ScreenshareModel.setUserId call correctly stores the userId from the message body, enabling tracking of which user initiated the screenshare session.


78-79: LGTM: User ID correctly passed to broadcast event.

The broadcastEvent call correctly includes msg.body.userId, ensuring the user identifier is included when notifying viewers about the screenshare broadcast.

akka-bbb-apps/src/main/scala/org/bigbluebutton/endpoint/redis/RedisRecorderActor.scala (3)

130-131: LGTM: New event handlers added to message routing.

The case handlers for ScreenshareRtmpBroadcastStartedEvtMsg and ScreenshareRtmpBroadcastStoppedEvtMsg are correctly added to the message handling logic, ensuring screenshare events are processed for recording.


811-818: LGTM: Screenshare start event handler follows established pattern.

The handleScreenshareRtmpBroadcastStartedEvtMsg handler correctly uses handleUserStatusChange with status "hasScreenShare" and value "true,stream=${stream}", following the same pattern as camera broadcasts (lines 454-456).


820-827: LGTM: Screenshare stop event handler mirrors start handler pattern.

The handleScreenshareRtmpBroadcastStoppedEvtMsg handler correctly uses the same pattern as the start handler but with value "false,stream=${stream}", maintaining consistency with the camera broadcast stop handler (lines 458-460).

akka-bbb-apps/src/main/scala/org/bigbluebutton/core2/message/senders/MsgBuilder.scala (4)

125-125: LGTM: Stop broadcast message builder updated with userId parameter.

The buildStopScreenshareRtmpBroadcastEvtMsg method signature correctly adds the userId parameter, maintaining consistency with the message case class definition shown in the relevant code snippets.


133-133: LGTM: Message body construction includes userId.

The ScreenshareRtmpBroadcastStoppedEvtMsgBody construction correctly includes the userId parameter, ensuring the user identifier is included in stop broadcast events.


563-563: LGTM: System message builder updated with userId parameter.

The buildScreenBroadcastStopSysMsg method signature correctly adds the userId parameter, aligning with the ScreenBroadcastStopSysMsgBody case class definition.


568-568: LGTM: System message body construction includes userId.

The ScreenBroadcastStopSysMsgBody construction correctly includes the userId parameter, ensuring user tracking is maintained in system-level stop messages.

bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/VoiceConfMsgs.scala (5)

18-20: LGTM: Voice conference event message body updated with userId.

The ScreenshareRtmpBroadcastStartedVoiceConfEvtMsgBody correctly adds the userId field, enabling tracking of which user initiated the screenshare broadcast from the voice conference perspective.


31-33: LGTM: Client event message body updated with userId.

The ScreenshareRtmpBroadcastStartedEvtMsgBody correctly includes the userId field, ensuring client-facing events contain user identification for screenshare broadcasts.


43-45: LGTM: Voice conference stop event message body updated with userId.

The ScreenshareRtmpBroadcastStoppedVoiceConfEvtMsgBody correctly adds the userId field, maintaining consistency with the start event message structure.


56-58: LGTM: Client stop event message body updated with userId.

The ScreenshareRtmpBroadcastStoppedEvtMsgBody correctly includes the userId field, ensuring both start and stop events have consistent user tracking capabilities.


132-134: LGTM: System message body updated with userId.

The ScreenBroadcastStopSysMsgBody correctly adds the userId field, enabling user tracking at the system level for screen broadcast stop operations.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sonarqubecloud

sonarqubecloud Bot commented Jun 4, 2025

Copy link
Copy Markdown

@prlanzarin
prlanzarin marked this pull request as ready for review June 4, 2025 19:20
@github-actions

github-actions Bot commented Jun 4, 2025

Copy link
Copy Markdown

Automated tests Summary

✅ All the CI tests have passed!

@antobinary
antobinary merged commit 8011333 into bigbluebutton:v3.0.x-release Jun 4, 2025
prlanzarin added a commit to prlanzarin/bigbluebutton-1 that referenced this pull request Jun 11, 2025
The ParticipantStatusChange event was recently extended
to support screen sharing - see b24d5a8, bigbluebutton#23326 for rationale
and implementation details.

Bump record-and-playback's version to `3.0.9` so we can identify
in which recordings those new events are present.
antobinary pushed a commit that referenced this pull request Jun 11, 2025
The ParticipantStatusChange event was recently extended
to support screen sharing - see b24d5a8, #23326 for rationale
and implementation details.

Bump record-and-playback's version to `3.0.9` so we can identify
in which recordings those new events are present.
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.

2 participants