getDisplayMedia/README.md
var displayMediaStreamConstraints = {
video: true // currently you need to set {true} on Chrome
};
if (navigator.mediaDevices.getDisplayMedia) {
navigator.mediaDevices.getDisplayMedia(displayMediaStreamConstraints).then(success).catch(error);
} else {
navigator.getDisplayMedia(displayMediaStreamConstraints).then(success).catch(error);
}
var displayMediaStreamConstraints = {
video: {
width: screen.width,
height: screen.height,
displaySurface: 'monitor', // monitor or window or application or browser
logicalSurface: true,
frameRate: 30,
aspectRatio: 1.77,
cursor: 'always', // always or never or motion
}
};
if (navigator.mediaDevices.getDisplayMedia) {
navigator.mediaDevices.getDisplayMedia(displayMediaStreamConstraints).then(success).catch(error);
} else {
navigator.getDisplayMedia(displayMediaStreamConstraints).then(success).catch(error);
}
cursor accepts three values:
displaySurface accepts four values:
logicalSurface accepts boolean true or false values.
There is no warranty, expressed or implied, associated with this product. Use at your own risk.
All WebRTC Experiments are released under MIT license . Copyright (c) Muaz Khan.