videorecording

js records the content played by vedio

Usage no npm install needed!

<script type="module">
  import videorecording from 'https://cdn.skypack.dev/videorecording';
</script>

README

VideoRecording.js

js库录制vedio播放的内容

npm downloads

代码演示:

var videoRecording = new VideoRecording(document.getElementById("video"))

document.getElementById("start").onclick = function () {
    videoRecording.startRecording();
}

document.getElementById("stop").onclick = function () {
    videoRecording.stopRecording().then((blob) => {
        document.getElementById('preview').src = window.URL.createObjectURL(blob);
    });
}

通过标签方式直接引入

<script src="VideoRecording.js"></script>

npm引入

npm install VideoRecording --save
import VideoRecording from "VideoRecording"

var videoRecording = new VideoRecording(document.getElementById("video"))

API

  • VideoRecording构造函数传参要录制的vedio Dom。
  • startRecording:开始录制。
  • stopRecording:停止录制,返回Promies;then方法的参数是录制完成的Blob对象

Issues提问