From e2ab31855c953f4ce1edb966072a6034525ada6a Mon Sep 17 00:00:00 2001 From: yhc002 <38403786+yhc002@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:12:30 +0900 Subject: [PATCH] don't use exact property for device ID Use ideal property instead of exact property when calling getUserMedia API. Since enumerateDevices API does not request device permission, the test page will not receive any device ID if camera permission is not already set nor will it trigger a device permission popup. Since getUserMedia API will be called with empty device ID using 'exact' property, test page will not display any video. --- src/content/getusermedia/resolution/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/content/getusermedia/resolution/js/main.js b/src/content/getusermedia/resolution/js/main.js index 9ab203688..10081bc76 100644 --- a/src/content/getusermedia/resolution/js/main.js +++ b/src/content/getusermedia/resolution/js/main.js @@ -236,7 +236,7 @@ function getMedia(constraints) { clearErrorMessage(); videoblock.style.display = 'none'; - constraints.video.deviceId = {exact: videoSelect.value}; + constraints.video.deviceId = {ideal: videoSelect.value}; console.log('getUserMedia constraints: ' + JSON.stringify(constraints)); navigator.mediaDevices.getUserMedia(constraints) .then(gotStream)