📝Update use of deprecated getUserMedia[ci skip]

This commit is contained in:
Daniel Pereira 2017-05-15 13:38:32 -05:00
parent c7e6cbcf9f
commit e38e294be3

View file

@ -16,7 +16,7 @@ desktopCapturer.getSources({types: ['window', 'screen']}, (error, sources) => {
if (error) throw error
for (let i = 0; i < sources.length; ++i) {
if (sources[i].name === 'Electron') {
navigator.webkitGetUserMedia({
navigator.mediaDevices.getUserMedia({
audio: false,
video: {
mandatory: {
@ -44,11 +44,11 @@ function handleError (e) {
```
To capture video from a source provided by `desktopCapturer` the constraints
passed to [`navigator.webkitGetUserMedia`] must include
passed to [`navigator.mediaDevices.getUserMedia`] must include
`chromeMediaSource: 'desktop'`, and `audio: false`.
To capture both audio and video from the entire desktop the constraints passed
to [`navigator.webkitGetUserMedia`] must include `chromeMediaSource: 'screen'`,
to [`navigator.mediaDevices.getUserMedia`] must include `chromeMediaSource: 'screen'`,
and `audio: true`, but should not include a `chromeMediaSourceId` constraint.
## Methods
@ -73,4 +73,4 @@ and calls `callback(error, sources)` when finished.
objects, each `DesktopCapturerSource` represents a screen or an individual window that can be
captured.
[`navigator.webkitGetUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/Navigator/getUserMedia
[`navigator.mediaDevices.getUserMedia`]: https://developer.mozilla.org/en/docs/Web/API/MediaDevices/getUserMedia