diff --git a/docs/api/desktop-capturer.md b/docs/api/desktop-capturer.md index 5f11d94561f6..7b897f2ad1bc 100644 --- a/docs/api/desktop-capturer.md +++ b/docs/api/desktop-capturer.md @@ -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) {