Cross video in Safari

Does anyone know if Safari supports an attribute crossoriginin an HTML5 tag <video>? I serve video from a server that meets all the necessary CORS headers, and I use the markup below to embed the video on my page. The page is being served from another domain.


<video controls crossorigin="anonymous" src="http://example.com/movie.mp4">
Then I draw the video onto the canvas and get the image from the canvas using the API toDataURL. This works in Chrome and Firefox, but Safari throws a security error as if there was no attribute on the video crossorigin.

Any ideas?

+5
source share
4 answers

crossdomain. crossorigin COR - (, ).

, , , http, https. w3 / ( ), , .

CORS : https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes

, , myme (?). *.mp4 . , , .

0

:

                         $.ajax({
                            type: 'get',
                            url : videoUrlFromAnotherDomain,
                            crossDomain: 'true',
                            success: function(data) {
                                // get a base64 version of the video!
                                var base64 = window.btoa(data);
                                // get a new url!
                                var newURL = 'data:video/mp4' + ';base64,' + base64;
                                // set the src on the video source element to the new url
                                video.find("source").attr("src", newURL);
                            }

"video/mp4" newURL.

0

CORS? , , . htmlinstant.com

<video src="http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4" controls />

CORS, , ​​ 2011 . . https://developer.mozilla.org/en-US/docs/HTML/CORS_settings_attributes

For an example of a video on canvas, see section 5.4 at this link: http://www.html5rocks.com/en/tutorials/video/basics/ I tested and it works on my safari.

-2
source

All Articles