Hello,
I’m trying to copy files over from my StreamingAssets directory to Android persistent data via www. Small files transfer fine but when I switch to a large file I get the following error:
You are trying to load data from a www stream which had the following error when downloading
jar:file:///data/app/[…].m4v aborted
A small .mov file copies and plays perfectly. A large m4v file errors out. It appears to have started trying to copy the file over but when I check on the device, the video file is 0k.
The code I’m using to copy over is as follows
String fromPath = "jar:file://" + Application.dataPath + "!/assets/";
String toPath = Application.persistentDataPath +"/";
String[] filesNamesToCopy = new string[] {filePath};
foreach (String fileName in filesNamesToCopy)
{
if (!System.IO.File.Exists (toPath + fileName)) {
Debug.Log("copying from "+ fromPath + fileName +" to "+ toPath);
WWW www1 = new WWW( fromPath + fileName);
yield return www1;
Debug.Log("yield done");
File.WriteAllBytes(toPath + fileName, www1.bytes);
Debug.Log("file copy done");
www1.Dispose ();
www1 = null;
} else {
Debug.Log("file exists! " + toPath + fileName);
}
}
Any help would be greatly appreciated!!
Thanks!