Allow cross-origin video in canvas
Updated: November 24, 2026
If your video plays but a web editor cannot save a frame, check the permissions between the page and the server delivering the file. Cross-origin resource sharing, or CORS, tells the browser which sites may read data from another origin. A canvas that you want to export needs permission to read those video pixels.
Find the two origins
In the browser network panel, identify the page address and the final video address. For example, editor.example and media.example are different origins even if the same team runs them. If you control the video host, configure its response to allow the exact HTTPS origin of the editor. If you use a delivery network, inspect the headers that actually reach the browser.
Request the video in the right mode
Set crossorigin="anonymous" before you assign the media address. This mode does not send credentials cross-origin. Use a file authorized for this workflow and check that the response header is present when the browser requests a byte range as well. If a third-party host does not grant read access, use an export you have permission to host.
Start with one canvas and a small file from the same storage to isolate the behavior. The example header grants access only to the editor. If your delivery network caches different responses by origin, configure that consistently and test from the exact page address the audience will use.
Access-Control-Allow-Origin: https://editor.exampleTest reading a frame
Start with a fresh canvas and wait until the video has a frame available. Draw that image and call the export or read method your tool uses. You should get an image of the current frame. If the call fails, check the final media request, including any redirects. Check whether earlier drawing operations put other cross-origin resources on the same canvas.
Frequently asked questions
An iframe displays another document’s player. For this workflow you need authorized access to the media file you draw.