Is there some HTML5 API that can help me record the screen (screencast)? I know about recording webcams etc, but I need the screen it self. It would help even more if this API was actually implemented in some cross-platform browser.
Screen capture is available as an experimental feature in Chrome, and you must enable it in your browser settings (chrome://flags/#enable-usermedia-screen-capture). Also, it seems to only work on an https connection.
navigator.getUserMedia({
video: {
mandatory: {
chromeMediaSource: 'screen'
// maxWidth: 640,
// maxHeight: 480
}
}
},
function (stream) {
//success! Now set up the video
var video = document.createElement('video');
video.src = window.URL.createObjectURL(stream);
video.autoplay = true;
//you can choose to display the video here or not.
},
function () {
//failure. browser is unable or permission denied
}
);
Once you have the video set up, it is possible to record it. There is a standard drafted for media recording, but it's not implemented in any browsers yet. However, it is still possible. Refer to this demo and sample code for a workaround.
Unfortunately, for now, this solution is available for Chrome only.
来源:https://stackoverflow.com/questions/16440120/record-screen-screencast-using-html5-e-g-getusermedia-or-something