开发者

Canvas Draw Image Error

I don't know why getting this error:

Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1

From running what is effectively:

my.ctx.drawImage(videoSelector, "358p开发者_StackOverflow中文版x", "0px", "920px", "599px", "358px", "0px", "920px", "599px");

I'm calculating these dimensions to crop the actual content area of the video tag. Because my video tag is 100% / 100%, which doesn't match up with the browser window size, there's black area that doesn't get translated to the canvas tag when mapping it over.

Any ideas on why I'm getting this error, or the best way to copy a same-size version of the video tag without it getting stretched?


According to the specs...

If the one of the source rectangle dimensions is zero, throws an INDEX_SIZE_ERR exception

And...

If one of the sw or sh arguments is zero, the implementation must raise an INDEX_SIZE_ERR exception.

You don't actually need to define the 'px' there, that could be causing it if the resulting value is interpreted incorrectly

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜