From ba7d7d42d9e4d22b7b883d50cb0f1727683411e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Beaufort?= Date: Fri, 6 Jan 2023 12:32:53 +0000 Subject: [PATCH] Use capabilities instead of settings for background blur --- image-capture/background-blur.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/image-capture/background-blur.js b/image-capture/background-blur.js index 0649d0ff33..9865be6c88 100644 --- a/image-capture/background-blur.js +++ b/image-capture/background-blur.js @@ -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}` ); }