Skip to content
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

fix(useDisplayMedia): stop stream when screen is not shared anymore #3976

Merged
merged 1 commit into from
May 27, 2024

Conversation

robertrosman
Copy link
Contributor

@robertrosman robertrosman commented May 17, 2024

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

Description

When the user stops sharing the screen, we need to stop the stream. Hence I've added an event listener to catch when the track ends, and call the stop function.

Additional context

Steps to reproduce the bug:

  1. Open Google Chrome (on mac).
  2. Start sharing screen (select a window, not just a tab).
  3. Look for the small notification that says "vueuse.org is sharing a window" (1. in the attachment).
  4. Click "Stop sharing".
  5. Before this fix the stream turns black, but is still in enabled state (2. in the attachment). After this fix it is properly stopped.

image

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label May 17, 2024
@antfu antfu merged commit a3c6f39 into vueuse:main May 27, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants