<div>
<video autoplay></video>
</div>
<button>start screen share</button>
video {
border: 1px solid #999;
width: 200px;
}
document.querySelector('button').addEventListener("click", async () => {
document.querySelector('video').srcObject = await navigator.mediaDevices.getDisplayMedia({
video: true,
audio: true
});
}, false);
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.