From ae353386e1af33e66763a52dbc28cad874153186 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sun, 8 Mar 2020 12:17:39 -0600 Subject: [PATCH] Fix race condition on camera --- toys/convulse/convulse.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/toys/convulse/convulse.js b/toys/convulse/convulse.js index 6d52c17..381f85f 100644 --- a/toys/convulse/convulse.js +++ b/toys/convulse/convulse.js @@ -76,12 +76,6 @@ class Convulse { vid.addEventListener("change", e => this.inputSelect(e)) this.inputSelect() - navigator.mediaDevices.getUserMedia({video: true, audio: true}) - .then(media => this.gotUserMedia(media)) - .catch(err => { - toast("Couldn't open camera!") - }) - navigator.mediaDevices.getDisplayMedia({video: {cursor: "always"}}) .then(media => { document.querySelector("#hello").classList.add("hidden") @@ -122,7 +116,7 @@ class Convulse { this.webcamVideo.muted = true this.webcamVideo.srcObject = media this.webcamVideo.play() - + // Set audio source for (let track of this.mediaStream.getAudioTracks()) { this.mediaStream.removeTrack(track)