p***@163.com
p***@163.com
  • 发布:2021-04-29 18:32
  • 更新:2021-04-29 18:32
  • 阅读:419

H5 画布能截取视频 吗?

分类:uni-app

var canvas = document.getElementById('canvasid-clip')
var video = document.getElementById("fuckvideo")
var ctx = uni.createCanvasContext('canvasid-clip', this)

            ctx.drawImage(video, 0, 0, 300, 300)  

            setTimeout(()=>{  
            ctx.draw(true, setTimeout(()=>{  
                uni.canvasToTempFilePath({  
                    x: 0,  
                    y: 0,  
                    width: 300,  
                    height: 300,  
                    fileType: 'png',  
                    canvasId: 'canvasid-clip',  
                    success: (res) => {  
                        base64ToPath(res.tempFilePath)  
                            .then(path => {  
                                this.clip = path  
                            })  
                            .catch(error => {  
                                console.error(error)  
                            })  
                    },  
                    fail: (res) => {  
                        console.log(res)  
                    },  
                    complete: () => {}  
                }, this)  
            },0))  
            },500)
2021-04-29 18:32 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复