Skip to content

feat: desktop screensharing #865

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 6, 2025
Merged

feat: desktop screensharing #865

merged 5 commits into from
Mar 6, 2025

Conversation

renefloor
Copy link
Contributor

🎯 Goal

Currently when screen sharing on desktop it shares all your screens next to each other. This is not useful at all if you use multiple screens. The goal is to make screen sharing usable on desktop

The goal is not to make screen sharing perfect on desktop, but at least it should be usable.

🛠 Implementation details

Localizations

First of all this PR adds localizations, because we didn't have those yet. For now they are included in the package, we can always separate them in a different package later if we want.
It uses standard arb files, but the dogfooding app contains an example on how to override some strings.

mediaConstraints

Previously the deviceId was always null. When selecting a screen or window we get a deviceId. When we select a different window later we have to reset the media stream to the new deviceId, otherwise the app will attempt to share the previous window again.

DesktopScreenShareSelector

The screen_share directory contains the widgets and the ValueNotifier to build a dialog where you can select a screen or window. Usually you would only show screens or windows, but the ScreenSelectorStateNotifier allows for a list of types, so you can also show both in 1 view.

The desktopScreenSelectorBuilder is only called on desktop platforms. Web has their own implementation already in de browser, so there is no need for it.

🎨 UI Changes

Default dialog:

image

With custom example enabled in the dogfooding app

image

🧪 Testing

You can test by running the app on a desktop platform. I've only been able to test macOS, but it should also work on windows and linux.

☑️Contributor Checklist

General

  • Assigned a person / code owner group (required)
  • Thread with the PR link started in a respective Slack channel (#flutter-team) (required)
  • PR is linked to the GitHub issue it resolves

☑️Reviewer Checklist

  • Sample runs & works
  • UI Changes correct (before & after images)
  • Bugs validated (bugfixes)
  • New feature tested and works
  • All code we touched has new or updated Documentation

@renefloor renefloor requested a review from a team as a code owner February 21, 2025 10:54
@renefloor renefloor changed the title Feat/desktop screensharing feat: desktop screensharing Feb 21, 2025
Copy link
Contributor

@Brazol Brazol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could add new documentation pages for those changes?

  • Guides/Localzation - with the description of this localization approach
  • Cookbooks/Desktop/Screen Sharing - with simple cookbook on how to manage and customize screen sharing on desktop

Copy link
Contributor

@Brazol Brazol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@renefloor renefloor merged commit 2301ecd into main Mar 6, 2025
3 checks passed
@renefloor renefloor deleted the feat/desktop-screensharing branch March 6, 2025 17:01
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