Hello everyone! I was hoping I could get some help with something really important.
I have a game that I made and the way my game works is that video clips play and the player clicks buttons to navigate to the next scene. My videos are set up as MovieTextures, which work fine on the EXE build. However, I am going to need it on a WebGL build and I know MovieTextures don’t work with WebGL. I know I can switch my videos to VideoClip, which I did before, but the WebGL build never worked (it never played the video in the scene).
I’m kind of lost on what to do here. My game will need to go on a website eventually and unless there is a way to get an EXE to work on a website, I am not sure what to do.
Any help would be appreciated.
Please let me know if you have any other questions. Thanks!
How do I make it an absolute path on my computer? Or is there a way to get an online URL working? I tried using a Youtube video of mine but the URL didn’t work for some reason.
You have to host it yourself, just like your webGL build you have to host it somewhere.
Youtube video’s don’t work with the Video Player component of Unity, because they are not an absolute path to a file. So for that you will need an asset from the asset store.
Okay, so I got it to play from a URL, which is a file path to where the video is on my computer, but when I export it, it still doesn’t play the video.
I’d say just test a few small fragments so you don’t have to wait too long to see if it works.
I don’t know any more specifics than it needing to be a .mp4 with h.264 encoding.
Is there a specific code I have to write in order to get it work on export? I read in some documentations that there’s some code for streaming assets that goes like this:
path = Application.dataPath + “/StreamingAssets”;
Do I have to put that somewhere in my code?
Like I said you need an absolute path. How you insert that in the video player url variable is up to you.
You can serialize it or set it via script
I don’t know out of mind if the Application.StreamingAssetsPath works in webgl. You’d have to test that…
Just debug log the path and look it up in the console.
If you have a server that is hosting the webgl build you probably end up with something like
Like I said, don’t know out of mind. Test it.
Simple empty scene with a script that does some debugs and sets the video url and starts it is all you need.
Hey guys. I’m still having trouble getting it to work. Can someone show me an example of a working URL that will play in both the editor AND the Web GL export?