[Unity 2018] Can't play videos in WebGL Builds

I need to export my Unity project to WebGL Builds where the player is able to display videos when he clicks on certain objects. The problem is that the videoplayer plays fine in editor mode but it doesn’t play at all once I build the project to WebGL.

When I looked on the web, it seems that you can’t have videoclips as source in your video player if you want to export to the web, it has to be an URL. So I tried to fiddle around with StreamingAssets folder and URL source from videoplayer but the problem is still there.

I think I have to type a very specific path into the URL section of the videoplayer in order for it to work but I have absolutly no idea what. I tried Application.streamingAssetsPath but even that doesn’t work.

I’m all out of options and I really need your help please.

I’ve stopped looking for a solution with Streaming Asset folder and I’m now trying my luck by hosting my videos online. I’m using a service called streamable where I host my videos. Again the video plays fine while in editor mode but doesn’t work once I build the project to WebGL. When I check in the console browser it says something like “Cross-Origin Request Blocked”. What do I need to do in order for this “Cross-Origin Request” thing to work so I can play my videos on my webgl builds?

1 Like

I’m hosting the videos I’m trying to play on a XAMPP server located on my machine. Just like previously I can play the videos in editor mode just fine but once in WebGL mode I can’t play them anymore because of the “COR” error thing.

Apparently I need to set up a file on my XAMPP server so I can allow my WebGL Unity to access it and play the videos, but I don’t know how to do that. Could anyone of you guys help me ?

did you guys got a solution or unity support has answered you something??