1.0.0-beta.4 • Published 4 years ago

zr-video-capture v1.0.0-beta.4

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

使用说明

js中使用:

1.引入js文件

<script src="video.js"></script>
<div id="videoWrap"></div>
    <script>
        const videoWrap = document.getElementById('videoWrap');

        const video = new Recorder({
            wrapElement: videoWrap,
            class: ''  // 自定义的类名,
           // type: 'text',  // 选填
           // accept: 'video/*' // 选填
        }, (res) => {
            console.log(res); // res为返回的文件信息
            const video = document.createElement('video');
            video.src = res.url;
            video.autoplay = 'autoplay';
            video.controls = 'controls';
            videoWrap.appendChild(video);
        });
    </script>

vue/angular/react中使用

npm i zr-video-capture --save
import Recorder from 'zr-video-capture'

const video = new Recorder({
    wrapElement: '',
    class: '',  // 选填 自定义类名
    // type: 'text',  // 选填
    // accept: 'video/*' // 选填
}, (res) => {
    //返回文件信息
})
参数参数类型参数描述
wrapElementobject外层div元素(必填)
classobject上传框样式class(选填)
typestringfile/text...
acceptstringvideo/ / image/
方法参数描述
Recordernew Recorder({})
callbackcallback()