public IEnumerator DownloadStreamingVideoAndLoad(string strURL)
{
strURL = strURL.Trim();
Debug.Log("DownloadStreamingVideo : " + strURL);
WWW www = new WWW(strURL);
yield return www;
if (string.IsNullOrEmpty(www.error))
{
if (System.IO.Directory.Exists(Application.persistentDataPath + "/Data") == false)
System.IO.Directory.CreateDirectory(Application.persistentDataPath + "/Data");
string write_path = Application.persistentDataPath + "/Data" + strURL.Substring(strURL.LastIndexOf("/"));
/* if(System.IO.File.Exists(write_path) == true)
{
Debug.Log("Delete : " + write_path);
System.IO.File.Delete(write_path);
}
*/
System.IO.File.WriteAllBytes(write_path, www.bytes);
Load("file://" + write_path);
}
else
{
Debug.Log(www.error);
}
www.Dispose();
www = null;
Resources.UnloadUnusedAssets();
}