html5 录制/保存视频/录音


国内这方面的资料真少的可怜,翻出去一搜一大把,推荐一个github的插件库,非常强大,支持各种各样的录制方式.

下载完成之后,引用对应的js立即可以使用.

<script src="RecordRTC/RecordRTC.js"></script>
<script src="part-of-screen-sharing/screenshot.js"></script>
<div id="elementToShare" style="width:50%;height:50%;background:green;">
<input></input>

</div>
<button onclick="start()">start</button>
<button onclick="stop()">stop</button>

<script>
var elementToShare = document.getElementById('elementToShare');
var recorder = RecordRTC(elementToShare, {
    type: 'canvas'
});
function start(){
    recorder.startRecording();
}

function stop(){
    recorder.stopRecording(function(url) {
    window.open(url);
});
}

</script>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM