我使用一个video标签在网页中捕获视频的截图并将其放入img元素中。然后我想把它放到后面的代码里,这样我就可以处理它的位图了。我在回发中使用更新面板。当我在调试器中运行时,它从视频中捕获图像,构建画布,将图像绘制到元素中,正确显示图像,然后在代码隐藏中调用Decode函数。但是图src在代码隐藏解码函数中为空。
<asp:UpdatePanel runat="server" UpdateMode="Conditional" EnablePartialRendering="true"/>
<asp:Button runat="server" AutoPostBack="true" OnClientClick="return screenshotButton()" OnClick="Decode" Text="Capture"></asp:Button>
<canvas id="theCanvas" style="display: none;"></canvas>
<img runat="server" Name="theImg" Id="theImg"/>
</asp:UpdatePanel>
...
function screenshotButton() {
canvas.width = videoElement.videoWidth;
canvas.height = videoElement.videoHeight;
canvas.getContext('2d').drawImage(videoElement, 0, 0);
theImg.src = canvas.toDataURL('image/webp');
return true;
};
我怎样才能在后面的代码中得到他们的位图?