我正在尝试使用 canvas

问题描述

它捕获图像,当我尝试使用 canva.toDataURL() 时,它不给我们图像并在控制台上抛出异常

(index):45 未捕获的 DOMException: 无法执行 'toDataURL' “HTMLCanvasElement”:受污染的画布可能无法导出。

 function shoot() { 
 var video = document.getElementById(videoId);
 var output = document.getElementById('output'); 
 var canvas = capture(video,scaleFactor); canvas.onclick = function(){ 
 window.open(this.toDataURL()); alert(this.toDataURL()) }; 
 snapshots.unshift(canvas);
 output.innerHTML = ''; 
 for (var i = 0; i < 1; i++) {
 output.appendChild(snapshots[i]); 
 } 

我认为这个 onclick 函数有问题

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)