Mathieu Anthoine Posted January 27, 2016 Share Posted January 27, 2016 Hi, I'm working on a game that needs to load images and videos from an other domain. It works fine with images after changing the request and response headers. With the videos it works when I'm on the same domain but when I call the video from an other domain I get this error: Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The video element contains cross-origin data, and may not be loaded. [GroupMarkerNotSet(crbug.com/242999)!:ACB77C09]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering. If someone encountered this issue before and has the solution, please help me, I'm totally stuck ! Quote Link to comment Share on other sites More sharing options...
xerver Posted January 27, 2016 Share Posted January 27, 2016 Have you tried ensuring that the server is sending proper CORS headers and potentially using the crossorigin="anonymous" attribute on your video element? Quote Link to comment Share on other sites More sharing options...
Mathieu Anthoine Posted January 27, 2016 Author Share Posted January 27, 2016 CORS: The server returns CORS but are they proper, I'm not sure. Have you an examples of what is needed ? I put an .htaccess with at the root of the domain <IfModule mod_headers.c> <FilesMatch "\.(png|mp4)$"> Header set Access-Control-Allow-Origin "*" </FilesMatch> </IfModule> crossorigin : Not sure where to set that. When I get the url of the video, I create a texture with Texture.fromVideoUrl After that I change the texture.baseTexture.source.crossorigin to "anonymous" and to finish I give the texture to a Sprite. Is that right ? But I still have the error Quote Link to comment Share on other sites More sharing options...
labrat.mobi Posted January 27, 2016 Share Posted January 27, 2016 When the video has finished loading, check for response header in browser network tools. See if access-control-allow-origin: * is sent or CORS was not setup properly. Quote Link to comment Share on other sites More sharing options...
Mathieu Anthoine Posted January 27, 2016 Author Share Posted January 27, 2016 The Texture.fromVideoUrl streams the video and doesn't wait to complete the loading. Whatever the response header has access-control-allow-origin: * Here is the Response Header HTTP/1.1 206 Partial Content Date: Wed, 27 Jan 2016 20:23:46 GMT Server: Apache/2.2.22 (Debian) Last-Modified: Fri, 15 Jan 2016 23:14:45 GMT ETag: "c401e-5d69f2-52967919e6340" Accept-Ranges: bytes Content-Length: 6121970 Access-Control-Allow-Origin: * Content-Range: bytes 0-6121969/6121970 Content-Type: video/mp4 Keep-Alive: timeout=15, max=100 Connection: Keep-Alive And the request header GET /muUrl/movie_fr.mp4 HTTP/1.1 Host: mySite.com Connection: keep-alive Pragma: no-cache Cache-Control: no-cache Accept-Encoding: identity;q=1, *;q=0 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.82 Safari/537.36 Accept: */* Referer: https://myReferer.com/ Accept-Language: fr-FR,fr;q=0.8,en-US;q=0.6,en;q=0.4,ru;q=0.2 Cookie: __utma=241289754.1724640338.1441224370.1452115023.1452769534.4; __utmz=241289754.1441224370.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none) Range: bytes=0- Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.