Jump to content

Can't play a cross domain video


Mathieu Anthoine
 Share

Recommended Posts

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 !

 

Link to comment
Share on other sites

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

 

Link to comment
Share on other sites

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-

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...