akonsu
akonsu

Reputation: 29576

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).

The script creates a canvas element and captures the video to the canvas using context.drawImage method. 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.

Is there a workaround?

Upvotes: 1

Views: 666

Answers (1)

Mikko Ohtamaa
Mikko Ohtamaa

Reputation: 83656

Set CORS headers on video files:

https://developer.mozilla.org/en/http_access_control

According to this bug report it is supported on <video> since Firefox 12:

https://bugzilla.mozilla.org/show_bug.cgi?id=682299

I think at least Chrome should support it, other browsers might not.

Upvotes: 1

Related Questions