//获取本地图片/视频链接
async function preview(e: any) {
const buffer = await e.target.files[0].arrayBuffer();
return URL.createObjectURL(new Blob([buffer]));
}
/**
* 截取本地视频第一帧
* 需要传入本地视频播放的video
* @intercpt
*/
//calssname==是渲染视频的video的id
function intercpt(calssname: HTMLElement) {
const canvas: any = document.createElement('canvas')
const ratio = calssname.offsetHeight / 9 / 16
canvas.width = Math.ceil(calssname.offsetHeight / 9) * 16
canvas.height = calssname.offsetHeight
canvas.getContext('2d').drawImage(calssname, 0, 0, canvas.width, canvas.height)
return canvas.toDataURL('image/png', 1.0)
}