Skip to content

Commit

Permalink
Use capabilities instead of settings for background blur
Browse files Browse the repository at this point in the history
  • Loading branch information
beaufortfrancois committed Jan 6, 2023
1 parent fb2e3a1 commit ba7d7d4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions image-capture/background-blur.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ navigator.mediaDevices.getUserMedia({ video: true })
document.querySelector("video").srcObject = mediaStream;

const [track] = mediaStream.getVideoTracks();
const settings = track.getSettings();
const capabilities = track.getCapabilities();

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

Expand Down

0 comments on commit ba7d7d4

Please sign in to comment.