Fix race condition on camera

This commit is contained in:
Neale Pickett 2020-03-08 12:17:39 -06:00
parent 0cc7fcb945
commit ae353386e1
1 changed files with 1 additions and 7 deletions

View File

@ -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)