Merge pull request #10303 from MathieuDebit/doc/fix-desktopcapture-example
📝 Fix desktopCapturer example
This commit is contained in:
commit
c784968e85
1 changed files with 6 additions and 2 deletions
|
@ -28,14 +28,18 @@ desktopCapturer.getSources({types: ['window', 'screen']}, (error, sources) => {
|
||||||
maxHeight: 720
|
maxHeight: 720
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, handleStream, handleError)
|
})
|
||||||
|
.then((stream) => handleStream(stream))
|
||||||
|
.catch((e) => handleError(e))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
function handleStream (stream) {
|
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) {
|
function handleError (e) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue