我试图使用Chrome的屏幕共享功能制作屏幕录像机并将视频保存为MP4格式。但是,我不知道我是如何做到这一点的。该演示是在https://figgycity50.kd.io/screencap.html(包括HTTPS!),代码为:将HTML5 blob视频导出为MP4
start
navigator.getUserMedia = navigator.webkitGetUserMedia || navigator.getUserMedia;
var stream = null;
button = document.querySelector("button");
function start(e) {
// Seems to only work over SSL.
navigator.getUserMedia({
video: {
mandatory: {
chromeMediaSource: 'screen',
maxWidth: 1280,
maxHeight: 720
}
}
}, function(s) {
stream = s;
button.textContent = 'Stop';
button.removeEventListener('click', start);
button.addEventListener('click', stop);
var video = document.querySelector('video');
video.src = window.URL.createObjectURL(stream);
video.autoplay = true;
stream.onended = function(e) {
//The save code should go here.
};
//document.body.appendChild(video);
}, function(e) {
});
}
function stop() {
stream.stop();
button.addEventListener('click', start);
button.textContent = 'Capture your screen';
}
button.addEventListener('click', start);
我该怎么办呢?