2011-05-17 26 views
2

我有一個Firefox插件,需要網頁截圖。它工作正常,除了Youtube:播放器不顯示在圖像中,它是空白的。我注意到Firefox的所有屏幕截圖插件的相同問題,除了Fireshot。畫布截圖Youtube頁面部分空白

的截圖是通過創建頁面上的HTML畫布上完成:

var canvas = window.document.createElementNS('http://www.w3.org/1999/xhtml', 'canvas'); 
canvas.width = width; 
canvas.height = height; 
canvas.style.width = canvas.style.maxwidth = width + "px"; 
canvas.style.height = canvas.style.maxheight = height + "px"; 
var context = canvas.getContext("2d"); 
context.save(); 
context.drawWindow(win, 0, 0, width, height, "rgb(255,255,255)"); 
context.restore(); 
var dataUrl = canvas.toDataURL('image/png'); 

我已經嘗試了幾件事情,但他們並沒有區別:

  • 集的wmode不透明
  • 延時截屏

截圖上的其他其他Flash元素網站,甚至是其他網站上嵌入的Youtube視頻都可以正常工作。

任何想法如何確保Youtube播放器是圖片的一部分?

+0

你可以發佈幾個截圖的結果嗎? – Alex 2012-09-12 10:44:41

回答

0

將wmode設置爲透明而非不透明。

+2

請在答案上詳細說明。 – 2012-11-04 18:23:01

+0

在上面的問題中,有人說「將wmode設置爲不透明」。所以我告訴這個人,而不是「將wmode設置爲透明」。這是基於這個問題的明確答案。 – Marcio 2013-01-02 16:29:14