From 2d2b15d4126e8e062b3ea6cb8f4d7c951cc722a2 Mon Sep 17 00:00:00 2001 From: xonx <119700621+xonx4l@users.noreply.github.com> Date: Wed, 23 Aug 2023 15:46:55 +0530 Subject: [PATCH] Update index.js An solution for issue -:#63 --- index.js | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index ed5c635..0f6625f 100644 --- a/index.js +++ b/index.js @@ -105,18 +105,19 @@ window.addEventListener("load", function() { ); }, "camera": function() { - navigator.mediaDevices ? - navigator.mediaDevices.getUserMedia( - {video: true}).then( - displayOutcome("camera", "success"), - displayOutcome("camera", "error") - ) : - navigator.getUserMedia( - {video: true}, - displayOutcome("camera", "success"), - displayOutcome("camera", "error") + if (navigator.mediaDevices) { + navigator.mediaDevices.getUserMedia({ video: true }).then( + function() { + displayOutcome("camera", "success"); + }, + function() { + displayOutcome("camera", "error"); + } ); - }, + } else { + displayOutcome("camera", "error"); + } +}, "microphone": function() { navigator.mediaDevices ? navigator.mediaDevices.getUserMedia(