HTML5 video load CORS issue

Hi, I’m testing an HTML5 app that needs to load files from a testing server running Apache, not on the same domain. I had a similar issue in the past and solved it by setting the headers on my testing Apache server. This is still working for picture, text and audio, but unfortunately not for video files. Does anyone know if there is something else I nedd to set? Here is my apache header setting:

<Directory "path to public folder here">
  Header set Access-Control-Allow-Origin '*'
  Header set Access-Control-Allow-Headers '*'
  Header set Access-Control-Request-Headers '*'

I’m using a NetStream object to load the video. I get an error about a missing “Access-Control-Allow-Origin” header (that I believe is, indeed, set).

To me, it sounds like you might not be 100% absolutely sure, since you said “I believe”. Perhaps it’s best to check in your web browser’s developer tools.

If you open up the developer tools, the Network tab will show every request from the page, including each request’s headers (If the network tab is empty, you may need to reload the page). You should be able to see Access-Control-Allow-Origin in there.

Well, I’m getting mixed results on that. For text files and php script calls the CORS seems to be correctly set, but when I try to get a video file it is not. Now this seems to be related to Apache itself, not OpenFL (I was initially wondering if there was something about the NetStrem class).

However this issue showed me I need to do a different approach to avoid problems while deplying the app. To do so I would need to change two things on my build script, but I did not find yet how to do it, any tips? First, I need the build call, “openfl test html5”, to save the result on a different folder (not the “Export/html5/bin” one). Second, it would be nice if it didn’t start the http server automatically after building. Is these two things possible? I was looking for the openfl and lime commands help and also the project.xml setup guide (XML Format) and didn’t find this.

Nevermind, found the output path setting :wink:

And to avoid launching the server I just run “build” instead of “test” :wink: duh…

1 Like