国内这方面的资料真少的可怜,翻出去一搜一大把,推荐一个github的插件库,非常强大,支持各种各样的录制方式.
下载完成之后,引用对应的js立即可以使用.
<script src="RecordRTC/RecordRTC.js"></script> <script src="part-of-screen-sharing/screenshot.js"></script> <div id="elementToShare" style="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>