[英]draw video to canvas across domains
I have a video
tag linked to a movie at content.mysite.com
, and I have a script file served from www.mysite.com
(different subdomain). 我在
content.mysite.com
有一个与电影链接的video
标签,并且我有一个脚本文件从www.mysite.com
(不同的子域)提供。
The script creates a canvas
element and captures the video to the canvas using context.drawImage
method. 该脚本创建一个
canvas
元素,并使用context.drawImage
方法将视频捕获到画布上。 But when I attempt to get the image data from the canvas using canvas.toDataURL
method, it fails with a security error because of cross domain restrictions. 但是,当我尝试使用
canvas.toDataURL
方法从画布获取图像数据时,由于跨域限制,它失败并出现安全错误。
Is there a workaround? 有解决方法吗?
Set CORS headers on video files: 在视频文件上设置CORS标头:
https://developer.mozilla.org/en/http_access_control https://developer.mozilla.org/en/http_access_control
According to this bug report it is supported on <video>
since Firefox 12: 根据此错误报告,从Firefox 12开始在
<video>
上受支持:
https://bugzilla.mozilla.org/show_bug.cgi?id=682299 https://bugzilla.mozilla.org/show_bug.cgi?id=682299
I think at least Chrome should support it, other browsers might not. 我认为至少Chrome应该支持它,其他浏览器可能不支持。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.