diff --git a/index.html b/index.html
index 1fc00e3..a7c7677 100644
--- a/index.html
+++ b/index.html
@@ -58,7 +58,13 @@
bpm = document.getElementById("bpm");
// Get the webcam's stream.
- navigator.getUserMedia(constraints, startStream, function () {});
+ if (navigator.mediaDevices.getUserMedia) {
+ navigator.mediaDevices.getUserMedia(constraints)
+ .then(startStream)
+ .catch(console.error)
+ } else {
+ navigator.getUserMedia(constraints, startStream, function () {});
+ }
}
function startStream(stream) {