html5 video blob源码,html - Export HTML5 blob video to MP4 - Stack Overflow

I am trying to use Chrome's screen sharing feature to make a screen recorder and save the video in MP4 format. However, I have no idea how I do this. The demo is at https://figgycity50.kd.io/screencap.html (include https!) and the code is:

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);

How do I do this?

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值