Skip to content

Commit

Permalink
Merge branch 'gh-pages' of https://github.com/GoogleChrome/samples in…
Browse files Browse the repository at this point in the history
…to gh-pages
  • Loading branch information
beaufortfrancois committed Jan 11, 2023
2 parents eb50588 + 321d770 commit f301b93
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions image-capture/background-blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,17 @@ navigator.mediaDevices.getUserMedia({ video: true })

// Check whether toggling background blur is supported or not.
if (capabilities.backgroundBlur?.length !== 2) {
throw new Error(
`Toggling background blur is not supported by ${track.label}`
);
throw Error(`Background blur toggle is not supported by ${track.label}`);
}

// Listen to background blur changes.
track.onconfigurationchange = onconfigurationchange;

const toggleButton = document.querySelector("button");
toggleButton.onclick = () => {
const backgroundBlur = track.getSettings().backgroundBlur;
const settings = track.getSettings();
track.applyConstraints({
advanced: [{ backgroundBlur: !backgroundBlur }],
advanced: [{ backgroundBlur: !settings.backgroundBlur }],
});
};
toggleButton.disabled = false;
Expand Down

0 comments on commit f301b93

Please sign in to comment.