getDisplayMedia demo
How to use?
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);
}
Edge
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
cursor accepts three values:
- always
- never
- motion
displaySurface
displaySurface accepts four values:
- monitor
- window
- application
- browser
logicalSurface
logicalSurface accepts boolean true or false values.
Spec
Disclaimer
There is no warranty, expressed or implied, associated with this product. Use at your own risk.
License
All WebRTC Experiments are released under MIT license . Copyright (c) Muaz Khan.