Skip to content

Instantly share code, notes, and snippets.

@JMPerez
Created December 17, 2016 14:43
Show Gist options
  • Save JMPerez/6b9e9ad08c76f7a97ee33e433707fac9 to your computer and use it in GitHub Desktop.
Save JMPerez/6b9e9ad08c76f7a97ee33e433707fac9 to your computer and use it in GitHub Desktop.
Asking for permission to get access to window recording and camera
// we ask for permission to record the window
// mediaSource could also be 'screen' if we wanted
// to record the entire screen
const getStreamForWindow = () => navigator.mediaDevices.getUserMedia({
video: {
mediaSource: 'window'
}
});
// we ask for permission to record the audio and video from the camera
const getStreamForCamera = () => navigator.mediaDevices.getUserMedia({
audio: true
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment