Created
December 31, 2022 15:00
-
-
Save kyktommy/89ad836527f58b700dacd6a79a7d122f to your computer and use it in GitHub Desktop.
Screen capture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
navigator.mediaDevices.getDisplayMedia({video:true}).then(function(stream){ | |
const mr=new MediaRecorder(stream,{mimeType:"video/webm;codecs=h264,opus"}); | |
mr.ondataavailable=function(ev){ | |
const a=document.createElement('a');a.href=URL.createObjectURL(ev.data); | |
a.download ='screen_capture.webm';a.click(); | |
}; // will be called when .stop() with ev.data as a Blob | |
mr.start(); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment