我正在使用視頻標簽來捕獲網頁中視頻的屏幕截圖并將其放入 img 元素中。然后我想將它發布到后面的代碼中,以便我可以處理它的位圖。我正在使用 UpdatePanel 進行回發。當我在調試器中運行它時,它會從視頻中捕獲圖像,構建畫布,將圖像繪制到元素中,正確顯示圖像,然后在后面的代碼中調用 Decode 函數。但是,解碼函數后面的代碼中的 img.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;};如何在后面的代碼中獲得 theImg 的位圖?
C#如何在.aspx后面的代碼中從動態<img>獲取位圖
寶慕林4294392
2022-10-15 14:26:06
