[x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
[x] 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:
Open Google Chrome (on mac).
Start sharing screen (select a window, not just a tab).
Look for the small notification that says "vueuse.org is sharing a window" (1. in the attachment).
Click "Stop sharing".
Before this fix the stream turns black, but is still in enabled state (2. in the attachment). After this fix it is properly stopped.
Before submitting the PR, please make sure you do the following
fixes #123
).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: