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

GetDisplayMedia: add Start/Stop switch #1616

Open
wants to merge 2 commits into
base: gh-pages
Choose a base branch
from

Conversation

eronnen
Copy link

@eronnen eronnen commented Aug 20, 2023

Description

Add a stop button to the getdisplaymedia demo

Purpose

  • Demonstrate how to stop screen sharing from JavaScript
  • Helps to stop screen sharing easily in automated tests

chrome_PsUcBGULUv

if (displaySurface !== 'default') {
options.video = {displaySurface};
startStopButton.addEventListener('click', () => {
if (startStopButton.textContent === 'Start') {

Choose a reason for hiding this comment

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

textContent is a state of dom. Wouldn't it be better make this decision based on explicitly defined boolean variable?

Copy link
Author

Choose a reason for hiding this comment

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

💯
added a displayMediaStarted boolean

…reen sharing started in order to demonstrate stopping screen share from javascript
@eronnen eronnen force-pushed the add-getdisplaymedia-sample-stop-javascript branch from 9c02ebd to 00c3b80 Compare October 17, 2023 21:54
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.

None yet

2 participants