I'm trying to stream a video in the Unity web player. I'm using the following code to fetch it:
string path = Application.streamingAssetsPath + "/" + video;
if (!path.Contains("://")) path = "file://" + path;
WWW www = new WWW(path);
MovieTexture texture = www.movie;
This works fine on the standalone player. However, on the web player, the path will be something like
file:///C:/Path/To/Deploy/Raw/trainToBeirut.ogv
Note the "Raw" in the file path. In reality Unity puts the video file at
file:///C:/Path/To/Deploy/StreamingAssets/trainToBeirut.ogv
In fact if I reaname StreamingAssets to Raw everything works fine. But that seems silly. Why is Unity wrong about the StreamingAssetsPath? How can I fix it short of renaming the folder or doing a needless conditional?
↧