Merge pull request #10303 from MathieuDebit/doc/fix-desktopcapture-example

📝 Fix desktopCapturer example
This commit is contained in:
Vanessa Yuen 2017-08-31 14:49:16 -04:00 committed by GitHub
commit c784968e85

View file

@ -28,14 +28,18 @@ desktopCapturer.getSources({types: ['window', 'screen']}, (error, sources) => {
maxHeight: 720
}
}
}, handleStream, handleError)
})
.then((stream) => handleStream(stream))
.catch((e) => handleError(e))
return
}
}
})
function handleStream (stream) {
document.querySelector('video').src = URL.createObjectURL(stream)
const video = document.querySelector('video')
video.srcObject = stream
video.onloadedmetadata = (e) => video.play()
}
function handleError (e) {