Hello, I’ve uploaded a WebGL game build to Unity Play that contains a video starting after the player presses the spacebar. After using “Build and Run” in the editor the video played perfectly in the localhost server.
I put the video in the StreamingAsset folder and used the url reference to the video in the script.
What can I do to solve the problem?
Its probably an authentication issue. The URL you list I cannot access either. It probably works for you normally because you are authenticated via the web browser. Try accessing the URL from an incognito window to make sure it is public.
Not sure exactly what is at play here, but like others have pointed out, do make sure that the resulting url that comes from your call to Path.Combine points to a path that exists and is accessible. Also pay attention to the WebGL-specific note in https://docs.unity3d.com/ScriptReference/Application-streamingAssetsPath.html (where it specifically says that files are not accessible in the normal way on WebGL). So it’s plausible that the file is simply not where you think it is.
Another thing to keep in mind is the CORS (Cross-Origin Resource Sharing) setup, in case the video file you’re playing ends up being on a different server than the rest of the game. You can read about CORS in Unity - Manual: Build your WebGL application (in the section about Moving build output files), as well as in the WebGL networking page.
Hey!
Could you find a solution to this? I am facing exactly same issue. My similar autogenerated URL (using same script) is giving 404. I am unable to find a solution to this.
Hello, the video I was trying to link was created with Cinemachine directly inside Unity. So, instead of saving it and trying to load it from somewhere, I simply let it play from the dedicated scene. You can do it for example by adding a start button that - when clicked - switches from the menu to the video scene.