2 回答
TA贡献1796条经验 获得超4个赞
takeScreenShot(){
return new Promise((resolve,reject)=>{
this.video.addEventListener("seeked", ()=>{
return resolve()
});
})
}
并使用调用它
this.takeScreenShot().then(()=>{
return this.pauseVideo()
}).then(()=>{
console.log("Successfull completed")
})
请看我知道这是否有帮助
TA贡献1966条经验 获得超4个赞
这就是我想出的解决方案。虽然这并不完全是Sandeep Nagaraj所建议的,但他的评论确实对我找到解决方案有很大帮助。因此,我赞成他担任这一职务。
async takeScreenShot(){
let seekResolve;
this.video.addEventListener("seeked", async () => {
if (seekResolve) seekResolve();
});
await new Promise(async (resolve,reject)=>{
console.log("promise running", this.video);
if(!this.ended){
if(this.animations.length){
this.pauseLotties()
}
this.pauseVideo();
await new Promise(r => (seekResolve = r));
this.layer.draw();
this.captures.push(this.canvas.toDataURL('image/webp'));
resolve()
this.takeScreenShot()
}
})
},
添加回答
举报